<template>
  <div class="add-exchange-order">
    <div class="quickOperation" data-key="ADD_EXCHANGE_ORDER">
      快捷操作：
      <Button
        type="fcdefault"
        style="margin-right:8px"
        @click="saveBefore"
      >
        保存
      </Button>
      <Button type="fcdefault"
      @click="closePage"
      >
        关闭
      </Button>
    </div>
    <div class="content">
      <div
        v-for="(item,tabId) in tabList"
        :key="tabId"
        class="block"
      >
        <foldPanel
          v-model="item.blockShow"
          :title="item.tabtext"
          :explain="item.explainText"
        >
          <div
            slot="content"
            class="block"
          >
            <div class="item">
              <!-- <div v-if="item.tabtext=='收货人信息'" style="position: relative;top:-20px;color:red;font-size:12px">如系统自动带出信息为乱码脱敏信息，请手工修改换货人信息（至平台后台查看）为正常地址，否则换货订单将无法发货。</div> -->
              <Row>
              <div
                v-for="(i,cindex) in tabList[tabId].list"
                :key="cindex"
                class="form"
              >
                <Col span="6" v-if="i.standard" >
                    <div
                      v-if="i.title"
                      :class="{'title':true,'returnLongText':(i.SKEY=='original_order_number'),'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>
                    <div v-if="i.SKEY=='exchange_postage'">
                      <InputNumber  v-model="i.VALUE"></InputNumber>
                      元
                    </div>
                  <Checkbox v-model="i.VALUE" v-else-if="i.SKEY=='exchange_reserved_stock'"></Checkbox>
                  <Select v-model="i.VALUE" :filterable="(i.SKEY !== 'buyer_province' && i.SKEY !=='buyer_city' && i.SKEY !== 'buyer_area')?true:false" clearable :disabled="i.disabled" class="input_box" v-else-if="(i.SKEY=='refund_delivery_type') || (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')"  @on-change="checkInput(i)" @on-query-change="checkInputSKU($event,i)">
                      <Option v-for="d in i.optionList" :value="d.value" :key="d.value">{{ d.label }}</Option>
                  </Select>
                  <Input
                    v-else-if="
                    (i.SKEY=='buyer_nickname')
                    ||(i.SKEY=='original_platform_number')
                    ||(i.SKEY=='system_order')
                    ||(i.SKEY=='all_hostname')
                    ||(i.SKEY=='all_hostno')
                    ||(i.SKEY=='platform_exchange_number')
                    ||(i.SKEY=='return_logistics_num')
                    ||(i.SKEY=='buyer_town')
                    ||(i.SKEY=='consignee_zip_code')
                    ||(i.SKEY=='consignee_people')
                    ||(i.SKEY=='consignee_mobile')
                    ||(i.SKEY=='consignee_phone')
                    ||(i.SKEY=='responsibility_person')
                    ||(i.SKEY=='platform_vip_code')
                    ||(i.SKEY=='BUYER_OPEN_UID')
                    "
                    class="input_box"
                    v-model.trim="i.VALUE"
                    :data-key="i.SKEY"
                    :placeholder="i.placeholder?i.placeholder:'请输入内容'"
                    :disabled="i.disabled"
                    :class="i.errorInput?'errorInput':''"
                    :regx="i.regx"
                    @on-blur="checkInput(i)"
                    @on-enter="(i.SKEY=='original_order_number' || i.SKEY=='original_platform_number')?checkInput(i):''"
                    @on-keypress='noSpaces($event,i)'
                    @paste.native='onPasteInput($event,i)'
                  />
                  <Input
                    v-else-if="i.SKEY=='original_order_number'"
                    class="input_box"
                    v-model.trim="i.VALUE"
                    placeholder="输入后请按enter"
                    :disabled="i.disabled"
                    :regx='i.regx'
                    :class="i.errorInput?'errorInput':''"
                    icon="ios-search"
                    @on-blur="checkInput(i)"
                    @on-enter="i.SKEY=='original_order_number'?checkInput(i):''"
                    @on-keypress='noSpaces($event,i)'
                    @on-click="searchMsg(i)"
                    @paste.native='onPasteInput($event,i)'
                  />
                  <!-- <img
                      v-if="i.search"
                      style="width:16px;margin-left:8px"
                      src="../../assets/icon/search.png"
                      @click="searchMsg(i)"
                      > -->
                </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"
                          @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="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>
                  <Input
                    style="max-width: 1000px;"
                    :rows="2"
                    v-model="i.VALUE"
                    :disabled="i.disabled"
                    type="textarea"
                    v-if="(i.SKEY=='refund_reasons')||(i.SKEY=='refund_instructions')||(i.SKEY=='buyer_message')"
                    placeholder="请输入内容" />
                </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>
                  <Input style="width:620px;"
                  :autosize='{minRows:2,maxRows: 5}'
                  v-model="i.VALUE"
                  type="textarea"
                  v-if="i.SKEY=='consignee_address'"
                  placeholder="请输入内容" />
                </Col>
              </div>
              </Row>
            </div>
          </div>
        </foldpanel>
        <Form
          class="form"
          v-if='tabId=="1"'
          :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>


    </div>
    <div class="tableArea">
      <Tabs type="card">
        <TabPane label="退回商品">
            <Row style="display: flex;
                justify-content: space-around;
                align-items: center;
                height: 48px;
                margin-bottom: 16px;
                background: #F8F8F8;">
              <Col span="8">
              <div style="display: flex;align-items: center;">
                <label style="width: 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" >
              <Button type="primary" icon="md-return-left" @click="addReturnGoods">添加</Button>
              </Col>
            </Row>
            <div class="handleBtn">
              <div class="handleItem" @click="deleteReturnGoods">【删除】</div>
            </div>
           <Table height="300"
            :columns="returnColumns"
            :data="currentReturnData"
            @on-select="selectReturnData"
            @on-select-cancel="selectReturnCancel"
            @on-select-all="selectReturnDataAll"
            @on-select-all-cancel="selectReturnDataCancel"
           ></Table>
           <div class="pageContent">
              <Page
                size="small"
                :current="returnCurrentPage"
                show-elevator
                :total="totalReturn"
                show-total
                show-sizer
                @on-change="changePageReturn"
                @on-page-size-change="changeSizeReturn"
              />
            </div>
        </TabPane>
        <TabPane label="换货商品">
            <Row style="display: flex;
                justify-content: space-around;
                align-items: center;
                height: 48px;
                margin-bottom: 16px;
                background: #F8F8F8;">
              <Col span="8">
              <div style="display: flex;align-items: center;">
                <label style="width: 30px;">SKU</label>
                <Select
                  ref="exchangeSelect"
                  style="width:240px"
                  v-model="selectSKUID"
                  @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" >
                <Button type="primary" icon="md-return-left" @click="addGoods">添加</Button>
              </Col>
            </Row>
            <div class="handleBtn">
              <div class="handleItem" @click="deleteExchangeGoods">【删除】</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
                :total="totalExchange"
                show-total
                show-sizer
                @on-change="changePageExchange"
                @on-page-size-change="changeSizeExchange"
              />
            </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.SOURCECODE"
              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"
                :isdroplistsearch="true"
                :searchcols="['PLATFORM','LOGISTICSNUMBER','ID','TID','SOURCECODE','ALLSKU','ALLNUM','ACTUALAMOUNT','RECEIVNAME','RECEIVPHONE','RECEIVMOBILE','RECEIVPROVINCE','RECEIVCITY','RECEIVAREA','RECEIVTOWN','RECEIVZIP','RECEIVADDRESS']"
              />
            </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="selectOrderModal"
      title="选择订单"
      width="400"
      :mask="mask"
      :closable="closable"
      :mask-closable="maskClosable"
      :footer-hide="hideFoot"
      @on-cancel="cancelSelectOrder">
      <div class="orderListByplatformId">
        <p style="margin-bottom: 12px;">根据输入的平台单号查询到多个订单号，请选择订单号进行操作</p>
        <div style="max-height: 200px;overflow-y: auto;">
          <p style="height:24px;line-height:24px;margin: 8px 0px;color: #0f8ee9;cursor: pointer;text-align: center;" v-for="item in orderListByplatformId" @click="chooseOrderIdbyplatform(item)">{{ item }}</p>
        </div>
      </div>
    </Modal>
  </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 {
    data() {
      return {
        saveArr:{
          REFUNDTYPE:'2',//单据类型
          ORIGINALORDERNO:'',//原订单编号
          OMSREASONTYPEID:'',//退款原因
          LOGISTICSCOMPANYID:'',//退回物流公司ID
          // COMPANY_NAME:'',//退回物流公司名称
          RECEIVPROVINCE:'',//省id
          RECEIVPROVINCENAME:'',//省
          RECEIVCITY:'', //市id
          RECEIVCITYNAME:'',//市
          RECEIVAREA:'', //区id
          RECEIVAREANAME:'',//区
          RECEIVADDRESS:'',//换货/收货人地址
          RECEIVNAME:'', //换货/收货人
          RECEIVMOBILE:'', //换货/收货人手机
          RECEIVPHONE:'', //换货/收货人电话

          VIRSTATUS:10,//退款状态
          ORDERFROM:'手工新增',
          ISRESERVEDSTOCK:0,//换货预留库存

          IS_NEEDUPDATETMALL_MCARD_PZ_SP: '',
          TMALL_MCARD_PZ_SP: '',
          SUB_ORDER_ID: '',
        },//最终保存入参
        // 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', // 换货金额
        SYSREMARK: '', //系统备注

        formValidate: { // 智能识别
          desc: '',
        },
        total: 0, // 退货单总金额
        tabList: [
          {
            tabId: '1',
            tabtext: '基本信息',
            blockShow: true,
            list: [
              {
                ID: '',
                SKEY: 'original_order_number',
                title: '原订单编号',
                VALUE: '',
                company: '',
                // regx: /^\d{0,50}?$/,
                tips: '',
                placeholder: '输入后请按enter',
                errorInput: false,
                disabled:false,
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                required: true, // 是否为必填项
                explain:true, //是否有解释
                search:true,//是否有搜索弹窗
                explainContent:'系统中的订单编号，非平台单号；如果不知道，请点击 放大镜查找，只有已经发货或交易完成的订单才能退货。',//解释文字
              },
              {
                ID: 'T_V_IESSHOP',
                SKEY: 'shop_name',
                title: '店铺',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                disabled:true,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                optionList:[]
              },
              {
                ID: '',
                SKEY: 'original_platform_number',
                title: '平台单号',
                VALUE: '',
                company: '',
                tips: '',
                disabled:false,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: '',
                SKEY: 'system_order',
                title: '系统单号',
                VALUE: '',
                placeholder:'请输入内容',
                company: '',
                tips: '',
                disabled:true,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: '',
                SKEY: 'exchange_reserved_stock',
                title: '换货预留库存',
                VALUE: false,
                defaultvalue: '',
                company: '',
                tips: '',
                flag: false, // 控制必填校验样式展示
                standard:true,//标准输入框长度
                explain:true, //是否有解释
                explainContent:'创建退换货单同时，系统自动创建一张未收款的换货单，用来占用库存，请不要对换货单手工收款。',
              },
              {
                ID: '',
                SKEY: 'all_hostname',
                title: '主播名称',
                VALUE: '',
                placeholder:'请输入内容',
                company: '',
                tips: '',
                disabled:true,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: '',
                SKEY: 'all_hostno',
                title: '主播ID',
                VALUE: '',
                placeholder:'请输入内容',
                company: '',
                tips: '',
                disabled:true,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: 'T_V_OMSLOGISTICSCOMPANY',
                SKEY: 'return_logistics_company',
                title: '退回物流公司',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                optionList:[]
              },
              {
                ID: '',
                SKEY: 'return_logistics_num',
                title: '退回物流单号',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: 'T_IESWAREHOUSE',
                SKEY: 'return_warehouse',
                title: '退回仓库',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                optionList:[]
              },
              {
                ID: '',
                SKEY: 'platform_exchange_number',
                title: '平台换货单号',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: '',
                SKEY: 'buyer_nickname',
                title: '买家昵称',
                VALUE: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: '',
                SKEY: 'platform_vip_code',
                title: '平台会员卡号',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: 'T_OMSREASONTYPE',
                SKEY: 'reason_refund',
                title: '退换货原因',
                VALUE:'',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                optionList:[]
              },
              {
                ID: '',
                SKEY: 'refund_delivery_type',
                title: '退货方式',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                disabled:true,
                required: false, // 是否为必填项
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                optionList:[
                  { label: '物流退货',value: '1' },
                  { label: '到店退货',value: '2' }
                ]
              },
              {
                ID: '',
                SKEY: 'BUYER_OPEN_UID',
                title: '买家OPENID',
                VALUE: '',
                company: '',
                tips: '',
                disabled:false,
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: '',
                SKEY: 'responsibility_person',
                title: '担责人',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: '',
                SKEY: 'exchange_postage',
                title: '换货邮费',
                VALUE: 0,
                standard:true,//标准输入框长度
                explain:true, //是否有解释
                explainContent:'换货的新订单邮费',
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: '',
                SKEY: 'refund_instructions',
                title: '退换货说明',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:false,//标准输入框长度
                remark:true,//备注栏
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: '',
                SKEY: 'buyer_message',
                title: '买家备注',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:false,//标准输入框长度
                remark:true,//备注栏
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: '',
                SKEY: 'refund_reasons',
                title: '内部备注',
                VALUE: '',
                defaultvalue: '',
                company: '',
                tips: '',
                standard:false,//标准输入框长度
                remark:true,//备注栏
                flag: false, // 控制必填校验样式展示
              },
            ],
          },
          {
            tabId: '2',
            tabtext: '收货人信息',
            explainText:'如系统自动带出信息为乱码脱敏信息，请手工修改换货人信息（至平台后台查看）为正常地址，否则换货订单将无法发货。',
            blockShow: true,
            list: [
              {
                ID: '',
                SKEY: 'consignee_people',
                title: '换货/收货人',
                VALUE: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                required: true, // 是否为必填项
              },
              {
                ID: '',
                SKEY: 'consignee_mobile',
                title: '换货/收货人手机',
                VALUE: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: '',
                SKEY: 'consignee_phone',
                title: '换货/收货人电话',
                VALUE: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: 'T_OMSREGION_PROVINCE',
                SKEY: 'buyer_province',
                title: '换货收货人省',
                VALUE: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                required: true, // 是否为必填项
                optionList:[]
              },
              {
                ID: 'T_OMSREGION_CITY',
                SKEY: 'buyer_city',
                title: '换货收货人市',
                VALUE: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: true, // 控制必填校验样式展示
                required: true, // 是否为必填项
                 optionList:[]
              },
              {
                ID: 'T_OMSREGION_AREA',
                SKEY: 'buyer_area',
                title: '换货收货人区县',
                VALUE: '',
                company: '',
                tips: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                optionList:[]
              },
              {
                ID: '',
                SKEY: 'buyer_town',
                title: '换货收货人街道',
                VALUE: '',
                placeholder:'',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: '',
                SKEY: 'consignee_zip_code',
                title: '换货/收货人邮编',
                VALUE: '',
                standard:true,//标准输入框长度
                flag: false, // 控制必填校验样式展示
              },
              {
                ID: '',
                SKEY: 'consignee_address',
                title: '换货/收货人地址',
                VALUE: '',
                standard:false,//标准输入框长度
                flag: false, // 控制必填校验样式展示
                required: true, // 是否为必填项
              }

            ],
          },
          {
            tabId: '3',
            tabtext: '退款金额',
            blockShow: true,
            list: [
              {
                ID: '',
                SKEY: 'refund_amount',
                title: '',
                VALUE: '',
                company: '',
                tips: '',
                all:true,//100%长度
                flag: false, // 控制必填校验样式展示
              }
            ],
          }
        ],
        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: 'QRCODE'
            },
            {
                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'
                    },
                    props: {
                      value: params.row.ORDERPRODUCTNUM,
                      disabled:true,
                      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'
                    },
                    props: {
                      value: params.row.ORDERPRODUCAMOUNT,
                      disabled: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.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) => {
                  return h(
                    'Input',
                    {
                      style: {
                        width:'66px'
                      },
                      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){
                                      return this.$Modal.fcWarning({
                                        title: '警告',
                                        mask: true,
                                        content: '【'+item.SKU+'】申请数量不能大于订单商品数量，请修改后保存'
                                      });
                                      // 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: 'ISGIFT',
                render: (h, params) => {
                  const vm = this;
                  return h('Select', {
                    style: {
                      zIndex: 999,
                    },
                    props: {
                      transfer: true,
                      value: params.row.ISGIFT, // 获取选择的下拉框的值
                    },
                    on: {
                      'on-change': (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: '退款金额',
              align: 'center',
                key: 'REFUND_FEE',
                render: (h, params) => {
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    props: {
                      value: params.row.REFUND_FEE,
                    },
                    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;
                          }
                        })
                        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: 'HOSTNAME'
            },
            {
                title: '主播ID',
                align: 'center',
                key: 'HOSTNO'
            },
            {
                title: 'PO',
                align: 'center',
                key: 'PO',
                renderHeader: this.tooltipRenderHeader('唯品会PO单号'),
                render: (h, params) => {
                  return h(
                    'Input',
                    {
                      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) //当前页面显示明细
                        }
                      }
                    },
                  );
                },
            },
        ],
        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,
                    },
                    on: {
                      'on-blur': (event) => {
                        let chengeData=this.currentExchangeData[params.index]
                        const tempVal = event.target.value;
                        const endVal = this.$comUtils.globalCarryAppend(tempVal, this.carryMethod);
                        event.target.value = endVal;
                        this.exchangeData.forEach(item=>{
                          if(item.SKU==chengeData.SKU){ 
                              item.REFUND_FEE = endVal;
                              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)
                      },
                      '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) => {
                return h(
                  'Input',
                  {
                    style: {
                      width:'66px'
                    },
                    props: {
                      value: params.row.REFUNDNUM,
                      number: 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// 这里是要渲染的数据
          //               }
          //             },
          //             ),
          //             ],
          //           ),
          //         ]
          //       )
          //     },
          // }
        ],
        currentExchangeData:[],//页面显示换货明细
        exchangeData:[],
        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: 'SOURCECODE'
            },
            {
                title: '物流单号',
                key: 'LOGISTICSNUMBER'
            },
            {
                title: '所有SKU',
                key: 'ALLSKU'
            },
            {
                title: '商品数量',
                key: 'ALLNUM'
            },
            {
                title: '订单总额',
                key: 'ACTUALAMOUNT'
            }
        ],
        allFix:{
          OrderStatus:["=5","=6"]
        },//全部发货表格过滤条件
        warehouseFix:{ //仓库发货表格过滤条件
          OrderStatus: "=5"
        },
        platformFix:{ //平台发货表格过滤条件
          OrderStatus: "=6"
        },
        tableHeight:'200',//表格高度
        currentReturnData:[],//当前显示退款明细
        returnData:[],
        returnDataNoSame:[],//弹窗中没有的退货商品
        submitArrReturn:[],//选中的退货商品
        // 退货商品page
        returnCurrentPage:1,
        totalReturn: 0, // 总条数
        currentPageReturn: 0, // 页码
        pageSizeReturn: 10, // 每页的条数

        originalModal:false,//原始清单编号弹窗
        mask:true,
        closable: true,
        maskClosable: false,
        hideFoot: true,
        shrinkHeight: '58px',
        currentValue: false,//默认收缩
        originalOrderData:{
          ID:'',//订单编号
          TID:'',//平台单号SOURCECODE
          SOURCECODE: '', //系统单号
          LOGISTICSNUMBER: '', //物流单号
          ALLSKU:'',//所有SKU
          RECEIVMOBILE:'',//收件人手机号码
          RECEIVNAME:'',//收件人
          USERNICK:'',//买家昵称
        },
        selectGoodsModal:false,//选择商品弹窗
        nowGoodsType:'',//当前商品表类型
        selectGoodsData:{//选择商品搜索条件
          NORMS1NAME:'',//颜色
          NORMS2NAME:'',//尺寸
          SKU:'',//SKU
          GBCODE:'',//国标码
          PRODUCTCODE:'',//商品编码
          PRODUCTNAME:''//商品名称
        },
        submitArrGoods:[],//选择商品表格选中项
        SKUColumns:[
          {
            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: '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,
        encryptColumns: [],
        disableColumns: [],

        shopGroupList: [], // 店铺列表数据
        orderListByplatformId:[], //平台单号带出多个订单列表
        selectOrderModal: false,
        platformId: '', // 原订单编号 平台ID
        preID:'',// 记录订单编号
        originalSID: '', // 原订单 物流单号
        carryMethod: 4, // 金额进位方式，保留2位小数还是4位小数,切换 原订单编号时会更新
      };
    },
    components: {
      foldPanel,
      ShrinkOrExtend,
      tableFaker
    },
    created(){
      this.getQuery('T_V_OMSLOGISTICSCOMPANY',{isactive: ['=Y']})// 初始查询物流公司列表
      this.getQuery('T_V_IESSHOP')// 初始查询店铺名称列表
      this.getQuery('T_OMSREASONTYPE',{REFUNDTYPE:2})// 初始查询退款原因

      // this.getQuery('T_IESWAREHOUSE')// 初始查询退货仓库
      this.getWAREHOUSE()// 初始查询退货仓库
      this.getProvinceList()// 初始获取省列表
      let currentId = this.$route.params.customizedModuleId;
      if (currentId !== '3211' && this.$route.query.copyAdd=='true') {  // 复制新增
        this.getRefundData(currentId)  //初始化查询退货表格数据
        this.getExchangeData(currentId) //初始化查询退换货表格数据
        this.getInitialData(currentId)  //初始化查询编辑数据
      } else {
        let WMSData=JSON.parse(localStorage.getItem('WMSRecallCopy'))
        this._isRecallCopy= WMSData ? true : false
        if(WMSData){
          this.getRefundData(WMSData)  //初始化查询退货表格数据
          this.getExchangeData(WMSData) //初始化查询退换货表格数据
          this.getInitialData(WMSData)  //初始化查询编辑数据
          localStorage.removeItem('WMSRecallCopy');
        }
      }
    },
    methods: {
      /**
       * 获取电商平台档案中订单发货流程校验省市区匹配系统地址
       * @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_03')
          }
        }
      },
      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>`
                  }
                }),
              },
            })
          ]);
        }
      },
      getqtyfee(params) {
        console.log(params)
        let TipList = '';
        params.rows.QTYFEEITEM.forEach(item => {
          let tipsList = '<p>'+item.storeName+':'+item.qtyfee+'</p>'
          TipList += tipsList;
        })
        this.exchangeData[params.index].TipList = TipList
            // let virtual = {
            //   "id": "47243",
            //   "sku": "YQ-LT20240115-002RL"
            // }
            // network.post('/p/cs/order/store/stock/qtyfee', virtual).then((res) => {
            //   let TipList = '';
            //   let startIndex=this.pageSizeExchange*(this.exchangeCurrentPage-1)
            //   let endIndex=startIndex+this.pageSizeExchange
            //   if (res.data.data.qtyfeeItems.length > 0) {
            //     res.data.data.qtyfeeItems.forEach(item => {
            //       let tipsList = '<p>'+item.storeName+':'+item.qtyfee+'</p>'
            //       TipList += tipsList;
            //     })
            //     this.exchangeData[params.index].TipList = TipList
            //     this.exchangeData[params.index].SKUWMSHOUSENUM = res.data.data.qtyfeeItems
            //   } else {
            //     this.exchangeData[params.index].TipList=''
            //     this.exchangeData[params.index].SKUWMSHOUSENUM=[];
            //   }
            //   this.exchangeData = JSON.parse(JSON.stringify(this.exchangeData))
            //   this.currentExchangeData=this.exchangeData.slice(startIndex,endIndex)
            // });
      },
      initHaveOrder() { // 从订单管理创建退货单跳转过来的，带原单单号
        this.tabList[0].list[0].search = false;
        this.okSelectId(this.$route.params.customizedModuleId)
      },

      // 获取敏感列
      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(id){
        await this.getSensitiveColumns()
        let virtual={
          table: "T_V_OMSREFUNDORDERALL",
          objid: id,
        }
        network.post('/p/cs/querySingleRefundOrder',virtual).then((res) => { // /p/cs/object/query
          console.log(res.data)
            let data=res.data
            this.refundablePostage=data.REFUNDSHIPAMOUNT
            this.saveArr.ORDERFROM=data.ORDERFROM
            this.saveArr.IS_NEEDUPDATETMALL_MCARD_PZ_SP = data.IS_NEEDUPDATETMALL_MCARD_PZ_SP
            this.saveArr.TMALL_MCARD_PZ_SP = data.TMALL_MCARD_PZ_SP
            this.SYSREMARK = data.SYSREMARK
            this.saveArr.OAID = '';
            this.saveArr.TID = data.TID;
            this.saveArr.is_manually_address = data.is_manually_address;
            this.saveArr.SUB_ORDER_ID = data.SUB_ORDER_ID;
            this.saveArr.BUY_ADDRESS_ID = data.BUY_ADDRESS_ID;
            this.saveArr.MANUAL_TRACKING_EDIT = data.MANUAL_TRACKING_EDIT;
            this.originalSID = data.SID
            if(this._isRecallCopy) {
              this.saveArr.BASIC_AMOUNT = data.BASIC_AMOUNT
              this.saveArr.IS_BATCH_CREATE = data.IS_BATCH_CREATE;
              this.saveArr.REFUND_BATCH_ID = data.REFUND_BATCH_ID;
              this.saveArr.PROCESS_STOREID = data.PROCESS_STOREID;
              this.saveArr.PLT_REFUND_TYPE = data.PLT_REFUND_TYPE;

            }
            // 根据平台号获取对应字段值
            this.platformId = data.PLATFORM;
            this.getPlatformInfo({ shopId: this.platformId });
            this.checkMoney()
            this.tabList[0].list.forEach((item,index)=>{
              if(item.SKEY=='buyer_nickname'){
                item.VALUE=data.BUYER_NICK
              }else if(item.SKEY=='original_order_number'){
                item.VALUE=data['ORIGINALORDERNO']
              }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=='all_hostname'){
                item.VALUE=data.ALLHOSTNAME
              }else if(item.SKEY=='all_hostno'){
                item.VALUE=data.ALLHOSTNO
              }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=='return_warehouse'){
                if(data.IESWAREHOUSEID!=-1){
                  item.VALUE=data.IESWAREHOUSEID.toString()
                  if(item.optionList.length == 0){
                    item.optionList=[{
                      label:data['IESWAREHOUSEID:WAREHOUSENAME'],
                      value:data.IESWAREHOUSEID.toString()
                    }]
                  }
                }
              }else if(item.SKEY=='platform_exchange_number'){//平台换货单号
                  item.VALUE=data.DISPUTE_ID
                  if(this._isRecallCopy){
                    item.disabled = true;
                  }
              }else if(item.SKEY=='responsibility_person'){//担责人
                  item.VALUE=data.RESPONSIBILITYPERSON
              }else if(item.SKEY=='platform_vip_code'){//平台会员卡号
                    item.VALUE=data.PLATFORMVIPCODE
              }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()
                  }]
                }
              }else if(item.SKEY=='exchange_reserved_stock'){// 接口开发新加
                console.log(1111111,data.SHOPID.toString())
                  this.shopGroupList.forEach(itemOne => {
                    if(itemOne.ID.val == data.SHOPID){
                      item.VALUE=itemOne.MANUAL_ISRESERVEDSTOCK.refobjval=='1'?true:false
                    }
                  })
                  // item.VALUE=data.ISRESERVEDSTOCK=='1'?true:false
                // item.VALUE=data.ISRESERVEDSTOCK=='1'?true:false
              }else if(item.SKEY=='return_logistics_num'){
                item.VALUE=data.SID
              }else if(item.SKEY=='refund_reasons'){
                item.VALUE=data.REMARK
              }else if(item.SKEY=='refund_instructions'){
                item.VALUE=data.RETURNDESC
              }else if(item.SKEY=='buyer_message'){
                item.VALUE=data.BUYERMESSAGE
              }else if(item.SKEY=='system_remarks'){
                item.VALUE=data.SYSREMARK
              } else if(item.SKEY=='refund_delivery_type') {
                item.VALUE=data.REFUND_DELIVERY_TYPE // 退货方式
              } else if(item.SKEY=='exchange_postage'){
                if(!data.RECEIVSHIPAMOUNT){
                  data.RECEIVSHIPAMOUNT=0
                }
                  item.VALUE=this.parser(data.RECEIVSHIPAMOUNT)
              }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()
                  }]
                }
              } else if(item.SKEY=='BUYER_OPEN_UID') {
                item.VALUE=data.BUYER_OPEN_UID // 退货方式
              }
            })
            this.tabList[1].list.forEach(item=>{
              if(item.SKEY=='consignee_address'){
                  item.VALUE=data.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()
                          }]
                      }
                    })
                    this.getCityList(data.RECEIVPROVINCE.toString());
                    item.VALUE=data.RECEIVPROVINCE.toString()
                    this.saveArr.RECEIVPROVINCE=item.VALUE
                    this.saveArr.RECEIVPROVINCENAME=data['RECEIVPROVINCE:REGIONNAME']
                  }
              }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()
                        }]
                    }
                  })
                  this.getAreaList(data.RECEIVCITY.toString());
                  item.VALUE=data.RECEIVCITY.toString()
                  this.saveArr.RECEIVCITY=item.VALUE
                  this.saveArr.RECEIVCITYNAME=data['RECEIVCITY:REGIONNAME']
              }else if(item.SKEY=='buyer_area'){
                  item.VALUE=data.RECEIVAREA.toString()
                  this.saveArr.RECEIVAREA=item.VALUE
                  this.saveArr.RECEIVAREANAME=data['RECEIVAREA:REGIONNAME']
              }else if(item.SKEY=='buyer_town'){
                  item.VALUE=data.RECEIVTOWN
                  this.saveArr.RECEIVTOWN=item.VALUE
              }else if(item.SKEY=='consignee_zip_code'){
                  item.VALUE=data.RECEIVZIP
              }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_mobile'){
                  // 复制新增时，敏感列不可见时设置空
                  if(this.encryptColumns.includes('RECEIVMOBILE') && this.$route.query.copyAdd=='true') {
                    item.VALUE = ''
                  } else {
                    item.VALUE=data.RECEIVMOBILE
                  }
              }
            })
        })
      },
      // 查询退换货明细
      getExchangeData(id){
          let virtual={
              fixedcolumns: {OMSRefundOrderId: id},
              range: 5000,
              startindex:0,
              table: "T_V_OMSCHANGEORDERPRODUCT",
          }
            network.post('/p/cs/list/query',virtual).then((res) => {
              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)
            })
      },
      // 查询退货明细
      getRefundData(id){
        let virtual={
            fixedcolumns: {OMSRefundOrderId:id},
            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 {
                res.data.rows[i][keyName] = res.data.rows[i][keyName].val;
              }
              }
              data.push(res.data.rows[i]);
            }
            this.returnData=data
            this.currentReturnData=this.returnData.slice(startIndex,endIndex) //当前页面显示明细
          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
                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()
          }
        })
      },
      // 判断字符串
      judgeStr(str){
        let judge=true
        if(str.indexOf('~~')==-1){
          if(str.indexOf('$$')==-1){
              if(str.indexOf('##')==-1){
                if(str.indexOf('&&')==-1){
                  judge=true
                }else{
                  judge=false
                }
              }else{
                 judge=false
              }
          }else{
            judge=false
          }
        }else{
          judge=false
        }
        return judge
      },
      // 重置数据
      resetData(){
        this.tabList.forEach(item=>{
          item.list.forEach(i=>{
            if(i.SKEY=='exchange_reserved_stock'){
              i.VALUE=false
            }else if(i.SKEY=='exchange_postage'){
              i.VALUE=0
            }else{
              i.VALUE=''
            }
          })
        })
        this.refundableAmount='0.0000'// 应退总金额
        this.refundablePostage='0.0000' // 应退邮费
        this.otherAmount='0.0000' // 其他金额
        this.exchangeAmount='0.0000'// 换货金额
        this.total=0 // 退货单总金额
        // 退回明细搜索栏重置
        this.returnGoodsNum=1
        this.$refs.returnSelect.clearSingleSelect()
        // 换货明细搜索栏重置
        this.exchangeGoodsNum=1
        this.$refs.exchangeSelect.clearSingleSelect()
        this.exchangeData=[]
        this.currentExchangeData=[]
      },
      // 关闭当前页面
      closePage(){
        const { fullPath } = this.$route;
        const {
          keepAliveModuleName,tableName
        } = this.$store.state.global.activeTab;
        this.$store.commit('global/tabCloseAppoint', {
          tableName,
          routeFullPath: fullPath,
          keepAliveModuleName,
          stopRouterPush: true,
        });
         // 跳转
        setTimeout(()=>{
          R3.store.commit('global/tabOpen', {
            type: 'S',
            tableName:'T_V_OMSREFUNDORDERALL',
            tableId:'10612',
            back:true
          });
        },0)
      },
      // 保存之前校验是否有其他非取消，作废状态下的退换货单
      saveBefore() {
        let params = {
          sourceCode: this.saveArr.TID // this.tabList[0].list.find(item=>item.SKEY=='original_platform_number').VALUE // 后端用的平台
        }
        network.post('/p/cs/refund/otherorder/query',params).then(res => {
          if(res.data.code == 0){
            if(res.data.data.length > 0){
              this.$Modal.confirm({
                  title: '提示',
                  content: '该订单已存在其它退换货单，请注意退款金额，是否继续？',
                  okText: '确定',
                  cancelText: '取消',
                  showCancel: true,
                  onOk: () => {
                    this.saveAll();
                  },
                  onCancel: () => {
                  }
                });
            }else {
              this.saveAll();
            }
          }
        })

      },
      //保存所有数据
      async saveAll() {
        // const res = await this.service.storageContent.getParamsList({});
        // if (res.data.code === 0) {
        //   res.data.data[0].sysParam.forEach(item => {
        //     if(item.paraName == 'sysrefund_auto_audit'){
        //       this.sysrefund_auto_audit = item.paraValue
        //     }
        //   })
        // }
        var flag=false;
        // 原订单编号
        setTimeout(() => {
          this.saveArr.ORIGINALORDERNO=this.tabList[0].list.find(item=>item.SKEY=='original_order_number').VALUE
          this.saveArr.IESWAREHOUSEID=this.tabList[0].list.find(item=>item.SKEY=='return_warehouse').VALUE //退回仓库 新加的
          this.saveArr.OMSREASONTYPEID=this.tabList[0].list.find(item=>item.SKEY=='reason_refund').VALUE
          this.saveArr.REFUND_DELIVERY_TYPE=this.tabList[0].list.find(item=>item.SKEY=='refund_delivery_type').VALUE
          this.saveArr.BUYER_OPEN_UID=this.tabList[0].list.find(item=>item.SKEY=='BUYER_OPEN_UID').VALUE

          if(this.saveArr.REFUNDTYPE=='2'){
              if(this.saveArr.ORIGINALORDERNO == "")
              {
                this.$Message.warning('获取不到原始订单');
                  return;
              }
              if(!this.saveArr.IESWAREHOUSEID)
              {
                this.$Message.warning('退回仓库不能为空');
                  return;
              }
              if(!this.returnData.length||!this.exchangeData.length){
                this.$Message.warning('明细为空，不能保存退单');
                return;
              }
              this.saveArr.BUYER_NICK=this.tabList[0].list.find(item=>item.SKEY=='buyer_nickname').VALUE
              this.saveArr.DISPUTE_ID=this.tabList[0].list.find(item=>item.SKEY=='platform_exchange_number').VALUE
              this.saveArr.REFUND_ID = this.saveArr.DISPUTE_ID // 平台退款单号
              this.saveArr.RESPONSIBILITYPERSON=this.tabList[0].list.find(item=>item.SKEY=='responsibility_person').VALUE
              this.saveArr.PLATFORMVIPCODE=this.tabList[0].list.find(item=>item.SKEY=='platform_vip_code').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.SYSREMARK = this.SYSREMARK

              this.saveArr.SHOPID=this.tabList[0].list.find(item=>item.SKEY=='shop_name').VALUE
              this.saveArr.LOGISTICSCOMPANYID = this.tabList[0].list.find(item => item.SKEY=='return_logistics_company').VALUE
              this.saveArr.SID=this.tabList[0].list.find(item=>item.SKEY=='return_logistics_num').VALUE
              this.saveArr.SOURCECODE=this.tabList[0].list.find(item=>item.SKEY=='system_order').VALUE
              this.saveArr.TID = this.tabList[0].list.find(item=>item.SKEY=='original_platform_number').VALUE
              this.saveArr.ALLHOSTNAME = this.tabList[0].list.find(item=>item.SKEY=='all_hostname').VALUE
              this.saveArr.ALLHOSTNO = this.tabList[0].list.find(item=>item.SKEY=='all_hostno').VALUE
              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.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
              //金额消除千分位
              this.saveArr.RefundShipAmount=this.parser(this.refundablePostage) // 应退邮费

              if(this.$route.params.customizedModuleId && this.$route.params.customizedModuleId != '3211'){
                this.saveArr.ORDERFROM = '手工新增'
              }
              this.saveArr.RefundOtherAmount=this.parser(this.otherAmount) // 其他金额

              // if(this.sysrefund_auto_audit == 'False' || this.sysrefund_auto_audit == 'false') {
              //   this.saveArr.VIRSTATUS = 1;
              // }
            
              // 物流单号有修改则传1，否则继承原来的
              if(this.originalSID !== this.saveArr.SID && this._isRecallCopy){
                this.saveArr.MANUAL_TRACKING_EDIT = 1
              }
              let ss = /[*]+/;
              let r = ss.test(this.saveArr.RECEIVADDRESS) || ss.test(this.saveArr.RECEIVNAME) || ss.test(this.saveArr.RECEIVPHONE) || ss.test(this.saveArr.RECEIVMOBILE);
              if (r) {
                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;
              }
              // 方法二
              // if(!(this.judgeStr(this.saveArr.RECEIVADDRESS)&&this.judgeStr(this.saveArr.RECEIVNAME)&&this.judgeStr(this.saveArr.RECEIVPHONE)&&this.judgeStr(this.saveArr.RECEIVMOBILE))){
              //   this.$Message.warning('收货人信息不能存在##,~~,&&,$$号');
              //   return;
              // }

              let virtual={
                table: "T_V_OMSONLINEORDER",
                isdroplistsearch: true,
                range: 100,
                startindex: 0,
                fkdrplist:{
                  searchcols:['PLATFORM', "RECEIVPROVINCENAME", "RECEIVCITYNAME", "RECEIVAREANAME", "RECEIVADDRESS", "RECEIVNAME","RECEIVMOBILE","RECEIVPHONE"]
                },
                fixedcolumns:{ID:[`=${this.saveArr.ORIGINALORDERNO}`]}
              };
              network.post('/p/cs/list/query', virtual).then((res) => {
                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]);
                }
                if (!data || data.length < 1 || data[0] == "" || data[0] == null) {
                    //获取不到原始订单
                    this.$Message.warning('获取不到原始订单');
                    return;
                }else{
                    if(data[0].RECEIVPROVINCENAME==null){
                        data[0].RECEIVPROVINCENAME='';
                    }
                    if(data[0].RECEIVCITYNAME==null){
                        data[0].RECEIVCITYNAME='';
                    }
                    if(data[0].RECEIVAREANAME==null){
                        data[0].RECEIVAREANAME='';
                    }
                    if(data[0].RECEIVADDRESS==null){
                        data[0].RECEIVADDRESS='';
                    }
                    if(data[0].RECEIVNAME==null){
                        data[0].RECEIVNAME='';
                    }
                    if(data[0].RECEIVMOBILE==null){
                        data[0].RECEIVMOBILE='';
                    }
                }
                network.post('/p/cs/object/query', {table: 'T_V_OMSONLINEORDER',objid: this.saveArr.ORIGINALORDERNO}).then((res) => {

                      let data=res.data
                      if (data) {
                          if (data.ORDERSTATUS != 5 && data.ORDERSTATUS != 6 && data.ORDERSTATUS != 11 && data.ORDERSTATUS != 12) {
                              //此订单状态不允许保存
                              this.$Message.warning('此订单状态不允许保存');
                          }
                          else {
                              this.submitData()
                          }
                      } else {
                          this.submitData()
                      }
                })
                .catch((error) => {
                  if (error.response) {
                    if (error.response.status == 500) {
                      console.log(error)
                      this.$Message.warning( error.response.statusText);
                    }
                  }
                });

              });
          }
        },400)
      },
      submitData(type){
        let CHANGEORDERCOUNT = 0;
        let RECEDEORDERCOUNT = 0;
        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
        }
        for(let i=0;i<this.returnData.length;i++){
          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(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: '请填写退款金额!'
            });
          }
        }
         this.returnData.forEach(item=>{
          item.ISRETURNGOODS=0;
          item.REFUND_FEE=this.parser(item.REFUND_FEE)
          item.ADJUSTAMOUNT=this.parser(item.ADJUSTAMOUNT)
          item.BASEPRICE=undefined
        })
        this.exchangeData.forEach(item=>{
          item.ISRETURNGOODS=1;
          item.REFUND_FEE=this.parser(item.REFUND_FEE)
          item.ADJUSTAMOUNT=this.parser(item.ADJUSTAMOUNT)
          item.BASEPRICE=undefined
        })
        console.log(this.exchangeData,'换货')
        // let CHANGEORDERCOUNT = 0;
        // let RECEDEORDERCOUNT = 0;
        let OMSCHANGEORDERPRODUCT=this.exchangeData.map(item=>{
          CHANGEORDERCOUNT += Number(item.REFUND_FEE)
          return {
            TITLE:item.TITLE,
            PRODUCTCODE:item.PRODUCTCODE,
            SKU:item.SKU,
            GBCODE:item.GBCODE,
            NORMSDETAILNAMES:item.NORMSDETAILNAMES,
            PRICE:item.PRICE,
            REFUND_FEE:item.REFUND_FEE,
            REFUNDNUM:item.REFUNDNUM,
            ROWSTATUS:item.ROWSTATUS,
            ISRETURNGOODS:item.ISRETURNGOODS,
            EXTSKUID:item.EXTSKUID,                                                                                              
            OID:item.OID,
          }
        })
        console.log(this.returnData,'退货')
        let OMSRECEDEORDERPRODUCT=this.returnData.map(item=>{
          RECEDEORDERCOUNT += Number(item.REFUND_FEE)
          return {
            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, //申请数量
            ISGIFT:item.ISGIFT,
            REFUND_FEE:item.REFUND_FEE,
            ISRETURNGOODS:item.ISRETURNGOODS,//判断商品是退货商品还是换货商品
            QRCODE: item.QRCODE,
            RETURN_BALANCE: item.RETURN_BALANCE,
            HOSTNAME: item.HOSTNAME,
            HOSTNO: item.HOSTNO,
            OID: item.OID,
            PLATUNDERTAKEAMOUNT: item.PLATUNDERTAKEAMOUNT,
            PO: item.PO
          }
        })
        console.log(OMSRECEDEORDERPRODUCT,'退货明细')
        CHANGEORDERCOUNT = this.standardMoney(this.parser(CHANGEORDERCOUNT))
        RECEDEORDERCOUNT = this.standardMoney(this.parser(RECEDEORDERCOUNT))
        // if(this.sysrefund_auto_audit == 'False' || this.sysrefund_auto_audit == 'false') {
        //   this.saveArr.VIRSTATUS = 1;
        // }else {
        //   if(CHANGEORDERCOUNT == RECEDEORDERCOUNT) {
        //     this.saveArr.VIRSTATUS = 10;
        //   }else {
        //     this.saveArr.VIRSTATUS = 1;
        //   }
        // }
        this.saveArr.VIRSTATUS = 1;
        console.log('新增换货单', this.saveArr)
        let virtual={
          table: "T_V_OMSREFUNDORDERALL",
          objId: -1,
          fixedData:{
            T_V_OMSCHANGEORDERPRODUCT: OMSCHANGEORDERPRODUCT, //换货
            T_OMSREFUNDORDERPRODUCT:OMSRECEDEORDERPRODUCT,//退货
            T_V_OMSREFUNDORDERALL:this.saveArr
          }
        }
        if(type == 'force'){
          virtual.step = 1
        }else {
          virtual.step = 0
        }
         network.post('/p/cs/refund/order/handAdd',virtual).then(res=>{
            if(res.data.code==0){
              this.$Message.success(res.data.message);
              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 : 'tableDetailAction'||'C',
                  label: '退换货单编辑',
                  customizedModuleName:'REFUNDUPDATE',
                  customizedModuleId:res.data.data.objId
                });
              },0)
            }else if(res.data.code==1) {
              this.$Modal.fcWarning({
                title: '提示',
                mask: true,
                showCancel: true,
                content: res.data.message,
                onOk:()=>{
                  this.submitData('force')
                }
              })
            }
         })
      },
      // 获取退货表格所有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(){
          // let obj=this.SKUAllDataReturn.find(item=>{
          //   return item.ID==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,
                  SHOWNORMSDETAILNAMES: obj.NORMS2NAME +'('+obj.NORMS2CODE+'),'+obj.NORMS1NAME,
                  BRANDNAME:obj.BRANDNAME,
                  NORMSDETAILNAMES: obj.NORMSDETAILNAMES,
                  PRICE:obj.SELLPRICE,
                  ISGIFT:obj.ISGIFT?obj.ISGIFT:0,
                  ID:obj.ID,
                  ISRETURNGOODS:0,
                  PICTUREURL:obj.PICTUREURL
                }
                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.push(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.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.push(addData)
                }
                this.$refs.returnSelect.clearSingleSelect()
                this.returnGoodsNum=1
                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
                 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.selectReturnSKUData = [];
                this.selectReturnSKUID = '';
                this.selectReturnSKUData={};

            }
          }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.SKUAllData[0].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(){
          // 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,
                  NORMSDETAILNAMES:obj.NORMSDETAILNAMES,
                  SHOWNORMSDETAILNAMES: obj.NORMS2NAME +'('+obj.NORMS2CODE+'),'+obj.NORMS1NAME,
                  PRICE:obj.SELLPRICE,
                  ADJUSTAMOUNT: 0,
                  ISRETURNGOODS : 1,//判断商品是退货商品还是换货商品
                }
                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.push(addData)
                  }else{
                    this.exchangeData.forEach(item=>{
                      if(obj.SKU==item.SKU){
                        let REFUNDNUM=item.REFUNDNUM
                        item=sameData
                        item.REFUNDNUM=Number(REFUNDNUM)+Number(this.exchangeGoodsNum)
                      }
                    })
                  }

                }else{
                  addData.REFUND_FEE=this.standardMoney(0)
                  addData.REFUNDNUM=this.exchangeGoodsNum
                  this.getCacuItemByProductCode(addData)
                  this.exchangeData.push(addData)
                }
                this.$refs.exchangeSelect.clearSingleSelect()
                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.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,
                    }
                  })
                  this.shopGroupList = res.data.rows;
                  if(this.$route.params.customizedModuleId && this.$route.params.customizedModuleId !='3211' && !this.$route.query.copyAdd){
                    this.initHaveOrder(); // 从订单管理创建退货单跳转过来的
                  }
                }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'){
                if(res.data.data.length == 1 && res.data.data[0].ID == item.optionList.value){

                }else {
                  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
                  }
                })
                this.cityList = item.optionList
              }
            })
          });
        }

      },
      // 获取区列表
      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
                  }
                })
              }
            })
          });
        }

      },

      // 智能识别获取省编号

      // 选择省份
      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,
            }));
            console.log(222,this.areaList)
            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) {
            // debugger
            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);
        }
      },

      // 选择商品 在单选下有效，选中某一项时触发
      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) //当前页面显示明细
      },
      // 换货删除
      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.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)

      },
      // 换货表格选中某项时触发
      selectExchangeData(selection, row) {
        this.submitArrExchange = selection;
      },
      // 换货表格取消某项时触发
      selectExchangeCancel(selection, row) {
        this.submitArrExchange = selection;
      // console.log("取消某项后要提交的数组",  this.submitArr)
      },
      // 换货表格全选
      selectExchangeDataAll(selection) {
        this.submitArrExchange = selection;
      // console.log("全选时提交的数组",  this.submitArr)
      },
      // 换货表格取消全选
      selectExchangeDataCancel(selection) {
        this.submitArrExchange = selection;
      // console.log("取消全选时提交的数组",  this.submitArr)
      },
      // 换货页码改变时触发
      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)
      },
      // 换货页数改变时触发
      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)
      },

      // 退货页码改变时触发
      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;
      },
      commonKeyupHandle(option) {
        const { $event, calcType } = option;
        const tempVal = $event.target.value;
        const endVal = this.$comUtils.globalCarryMethod(tempVal, this.carryMethod, true);
        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.otherAmount);
          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); //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')){
          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})
          // }
        }
      },
      getMessageByPlatformId() {
        // let ID= this.tabList[0].list.find(i=>i.SKEY=='original_order_number').VALUE
        let ID= this.tabList[0].list.find(i=>i.SKEY=='original_platform_number').VALUE
        if(ID==''){
          // this.$Message.warning('未找到系统订单号');
          return
        }else {
          let params = {
            id: this.tabList[0].list.find(i=>i.SKEY=='original_platform_number').VALUE
          }
          network.post('/p/cs/findOrderIdByParam', params).then((res) => {
            if(res.data.code == 0){
              if(res.data.data.length == 1){
                let virtual={id:res.data.data[0]}
                if (this.preID !== virtual.id) {
                  this.preID = virtual.id;
                  this.okSelectId(virtual.id);
                }
              
              }else if(res.data.data.length > 1){
                this.orderListByplatformId = res.data.data
                this.selectOrderModal = true;
              }
            }else {
              this.tabList[0].list.find(i=>i.SKEY=='original_platform_number').VALUE = ''
            }
          })
        }
      },
      chooseOrderIdbyplatform(item){
        this.selectOrderModal = false;
        if (this.preID !== item) {
            this.preID = item;
            this.okSelectId(item);
        }
        // this.ok(virtual,'','haveOrder')
      },
      cancelSelectOrder() {
        this.selectOrderModal = false;
        // this.tabList[0].list.find(i=>i.SKEY=='original_platform_number').VALUE = '';
      },
      checkInput(i){ //下拉框选中事件
        let skey = i.SKEY;
        let inputValue = i.VALUE;
        console.log(skey,'=========skey=========')
        if(skey=='original_order_number'){ //原订单编号 请求接口
          let ID= this.tabList[0].list.find(i=>i.SKEY=='original_order_number').VALUE
          if(ID==''){
            return
          }
          // this.getMessageByPlatformId();
          // let virtual={id:ID}
          // this.ok(virtual,'','haveOrder')
          if (this.preID !== ID) {
            this.preID = ID;
            this.okSelectId(ID);
          }
        }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);
          this.saveArr.LOGISTICSCOMPANYID=companyData?companyData.value:''
          // this.saveArr.COMPANY_NAME=companyData.label
        }else if(skey=='reason_refund'){ //退换货原因
          this.saveArr.OMSREASONTYPEID=inputValue
        }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:''
        }else if(skey == 'original_platform_number'){
          let ID= this.tabList[0].list.find(i=>i.SKEY=='original_platform_number').VALUE
          if(ID==''){
            // this.$Message.warning('未找到系统订单号');
            return
          }
          this.getMessageByPlatformId();
        }
      },

      onPasteInput(e, item) {
        e.preventDefault()
        e.target.value = e.clipboardData.getData('text/plain').trim()
        item.VALUE = e.target.value
      },

      // 平台单号，退款单号(换货单没有)，退回物流单号禁止输入空格
      noSpaces(e,i){
        if(i.SKEY=='original_platform_number' || i.SKEY=='system_order'||i.SKEY=='return_logistics_num'){
          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:'',//平台单号SOURCECODE
          SOURCECODE: '', //系统单号
          ALLSKU:'',//所有SKU
          RECEIVMOBILE:'',//收件人手机号码
          RECEIVNAME:'',//收件人
          USERNICK:'',//买家昵称
        },
        // 初始化过滤条条件
        this.allFix={//全部发货表格过滤条件
          OrderStatus:["=5","=6"]
        }
        this.warehouseFix={ //仓库发货表格过滤条件
          OrderStatus: "=5"
        }
        this.platformFix={ //平台发货表格过滤条件
          OrderStatus: "=6"
        }
        this.nowTab='all'
        this.originalModal=false
      },

      // 查询订单
      searchOrder(id) {
        const params = {
          fixedcolumns: {
            ALLSKU: '',
            ID: String(id),
            LOGISTICSNUMBER: '',
            OrderStatus:["=1","=2","=3","=4","=5","=6","=7","=21","=50"],
            RECEIVMOBILE: '',
            RECEIVNAME: '',
            SOURCECODE: '',
            TID: '',
            USERNICK: ''
          },
          isdroplistsearch: true,
          range: 10,
          startindex: 0,
          table: 'T_V_OMSONLINEORDER',
          fkdrplist: {
            searchcols: ['PLATFORM','LOGISTICSNUMBER','ID','TID','SOURCECODE','ALLSKU','ALLNUM','ACTUALAMOUNT','RECEIVNAME','RECEIVPHONE','RECEIVMOBILE','RECEIVPROVINCE','RECEIVCITY','RECEIVAREA','RECEIVTOWN','RECEIVZIP','RECEIVADDRESS']
          }
        }
        return network.post('/p/cs/list/query', params).then(res => {
          const data = res.data.rows[0] || {}
        
          if (data) {
            Object.keys(data).forEach(key => {
              data[key] = data[key].val
            });
          } else {
            console.error('Data is undefined or null');
          }
          return data
        })
      },

      okSelectId(ID){
        if(ID){ // 订单管理创建换货单
          let virtual = {
            id: ID,
          };
          let virtual1 = {
            table: 'T_V_OMSONLINEORDER',
            objid: ID,
            columns: ['PLATFORM', 'RECEIVPHONE', 'RECEIVNAME', 'RECEIVMOBILE', 'RECEIVADDRESS'],
            type: 0,
            isrefundorder: 1,
          };
          network.post('/p/cs/showProtectData', virtual1).then((res) => {
            if (res.data.code == 0) {
              if(res.data.message !== 'SUCCESS'){
                this.$Modal.fcError({
                  title: '提示',
                  mask:true,
                  content: res.data.message
                });
              }
              let showData = res.data.data;
              this.ok(virtual,showData)
            }else if(res.data.code == 10){
              // this.$Modal.fcError({
              //   title: '提示',
              //   mask:true,
              //   content: '获取原单收件人信息失败，请手工填写收货人信息！'
              // });
              // this.$Message.warning('获取原单收件人信息失败，请手工填写收货人信息！')
              // let showData = res.data.data?res.data.data:'';
              // this.ok(virtual,showData)
              this.searchOrder(ID).then(data => {
                let showData = data
                this.ok(virtual,showData)
              })
            }else if(res.data.code == -3){
              this.$Modal.fcError({
                title: '提示',
                mask:true,
                content: '您没有查看敏感信息的权限，无法手工新增退换货单，如需使用请联系管理员至【用户档案】中开通【可查看客户敏感信息】权限。'
              });
              this.reset()
            }else{
              this.reset()
            }
          })
        }else {
          this.tabList[0].list.forEach(item=>{
            if(item.SKEY=='original_order_number'){
              // item.VALUE=this.selectTableData.ID
              if(this.selectTableData.ID){
                item.VALUE=this.selectTableData.ID
                let virtual = {
                  id: +item.VALUE,
                };
                let virtual1 = {
                      table: 'T_V_OMSONLINEORDER',
                      objid: +item.VALUE,
                      columns: ['PLATFORM','RECEIVPHONE', 'RECEIVNAME', 'RECEIVMOBILE', 'RECEIVADDRESS'],
                      type: 0,
                      isrefundorder: 1,
                };
                network.post('/p/cs/showProtectData', virtual1).then((res) => {
                  if (res.data.code == 0) {
                    if(res.data.message !== 'SUCCESS'){
                      this.$Modal.fcError({
                        title: '提示',
                        mask:true,
                        content: res.data.message
                      });
                    }
                    let showData = res.data.data;
                    this.ok(virtual,showData)
                  }else if(res.data.code == 10){
                    // this.$Modal.fcError({
                    //   title: '提示',
                    //   mask:true,
                    //   content: '获取原单收件人信息失败，请手工填写收货人信息！'
                    // });
                    // this.$Message.warning('获取原单收件人信息失败，请手工填写收货人信息！')
                    // let showData = res.data.data?res.data.data:'';
                    let showData = this.selectTableData
                    this.ok(virtual,showData)
                  }else if(res.data.code == -3){
                    this.$Modal.fcError({
                        title: '提示',
                        mask:true,
                        content: '您没有查看敏感信息的权限，无法手工新增退换货单，如需使用请联系管理员至【用户档案】中开通【可查看客户敏感信息】权限。'
                    });
                    this.reset()
                  }else{
                    this.reset()
                  }
                })
              }else{
                if(!item.VALUE){
                  this.$Message.warning('至少选择一条订单')
                }else {
                  this.originalModal=false
                }
              }

            }
          })
        }
      },
      ok(virtual,showData, type){
        // if(!type || type !== 'haveOrder'){
          this.resetData()
        // }
        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.saveArr.TID = data.TID
            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'){
                this.tabList[0].list.find(item=>item.SKEY=='original_order_number').errorInput = false;
                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=='exchange_reserved_stock'){// 接口开发新加，换货预留库存
                this.shopGroupList.forEach(itemOne => {
                  if(itemOne.ID.val == data.ORDERSHOPID){
                    item.VALUE=itemOne.MANUAL_ISRESERVEDSTOCK.refobjval=='1'?true:false
                  }
                })
                // item.VALUE=data.ISRESERVEDSTOCK=='1'?true:false
              }else if(item.SKEY=='all_hostname'){
                item.VALUE=data.ALLHOSTNAME
              }else if(item.SKEY=='all_hostno'){
                item.VALUE=data.ALLHOSTNO
              }else if(item.SKEY=='shop_name'){
                item.VALUE=data.ORDERSHOPID.toString()
              }else if(item.SKEY=='responsibility_person'){//担责人
                item.VALUE=data.RESPONSIBILITYPERSON
              }else if(item.SKEY=='platform_vip_code'){//平台会员卡号
                item.VALUE=data.PLATFORMVIPCODE
              }else if(item.SKEY=='return_warehouse'){
                // 没有退货仓库字段
                if(data.IESWAREHOUSEID.toString()==-1){
                  // this.getQuery('T_IESWAREHOUSE')
                  this.getWAREHOUSE()// 初始查询退货仓库
                  setTimeout(()=>{
                    item.VALUE=''
                  },200)
                }else{
                  // this.getQuery('T_IESWAREHOUSE',{ID:data.IESWAREHOUSEID.toString()})
                  this.getWAREHOUSE()// 初始查询退货仓库
                  setTimeout(()=>{
                    item.VALUE=data.IESWAREHOUSEID.toString()
                  },200)
                }

              }
            })
            this.tabList[1].list.forEach(item=>{
              if(item.SKEY=='buyer_province'){
                let provinceData = item.optionList.find((item) => item.value == data.RECEIVPROVINCE); //在省列表中找对应的省id
                item.VALUE=provinceData?provinceData.value.toString():''
                if(item.VALUE){
                  this.getCityList(item.VALUE)
                  this.saveArr.RECEIVPROVINCE=provinceData?provinceData.value:''
                }
              }else if(item.SKEY=='buyer_city'){
                item.VALUE=data.RECEIVCITY?data.RECEIVCITY.toString():''
                if(item.VALUE){
                  this.getAreaList(data.RECEIVCITY)
                  this.saveArr.RECEIVCITY=item.VALUE
                }
              }else if(item.SKEY=='buyer_area'){
                item.VALUE=data.RECEIVAREA?data.RECEIVAREA.toString():''
                this.saveArr.RECEIVAREA=item.VALUE
              }else if(item.SKEY=='buyer_town'){
                item.VALUE=data.RECEIVTOWN
                this.saveArr.RECEIVTOWN=item.VALUE
              }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=='all_hostname'){
                item.VALUE=data.ALLHOSTNAME
              }else if(item.SKEY=='all_hostno'){
                item.VALUE=data.ALLHOSTNO
              }else if(item.SKEY=='consignee_mobile' && showData){
                item.VALUE=showData.RECEIVMOBILE?showData.RECEIVMOBILE:''
              }else if(item.SKEY=='consignee_people' && showData){
                item.VALUE=showData.RECEIVNAME?showData.RECEIVNAME:''
              }else if(item.SKEY=='consignee_phone' && showData){
                item.VALUE=showData.RECEIVPHONE?showData.RECEIVPHONE:''
              }else if(item.SKEY=='consignee_address' && showData){
                item.VALUE=showData.RECEIVADDRESS?showData.RECEIVADDRESS:''
              }
            })
            this.refundableAmount=data.RECEIVEDAMOUNT
            // 根据平台号获取对应字段值
            this.platformId = data.PLATFORM;
            this.getPlatformInfo({ shopId: this.platformId });
            this.checkMoney()
          }else {
            this.tabList[0].list.find(item=>item.SKEY=='original_order_number').errorInput = true;
            console.log(this.tabList[0].list)
            this.$Message.warning('订单编号不存在!');
          }
          if(this.originalModal  && type != 'haveOrder'){
            this.cancel()
          }
        })
      },
       // 重置
      reset() {
        this.originalOrderData={
          ID:'',//订单编号
          TID:'',//平台单号SOURCECODE
          SOURCECODE: '', //系统单号
          ALLSKU:'',//所有SKU
          RECEIVMOBILE:'',//收件人手机号码
          RECEIVNAME:'',//收件人
          USERNICK:'',//买家昵称
          // ACTUALAMOUNT:'',//订单总额
          // 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
        console.log(this.selectTableData, 'selectTableData_01');
      },
      upOrDown(height) {
        this.currentValue = !this.currentValue;
        document.getElementsByClassName('conditionContent')[0].style.maxHeight = this.currentValue ? height : '';
        this.tableHeight = this.currentValue ? '250' : '200';
      },
    }
  };
</script>
<style lang="less">

.add-exchange-order .foldPanelContent .ark-collapse > .ark-collapse-item > .ark-collapse-content {
  padding-top: 0px;
}
.add-exchange-order .ark-collapse-content > .ark-collapse-content-box {
  padding-bottom: 0px;
}
.add-exchange-order .content .ark-col {
  margin-bottom: 8px;
}
.add-exchange-order .content .ark-col-span-6 {
  margin-bottom: 8px;
}

.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: 240px;
      min-width: 180px;
    }

   .ark-input-wrapper /deep/ textarea{
      resize: none;
      min-height: 36px!important;
    }
    .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: 160px;
    // }
  }

}
.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>
  .add-exchange-order {
    padding: 0 16px;
  }
 .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;
        }
    }
  }
  .content /deep/ .ark-select-input[disabled]{
      color: #575757;
  }

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