<template>
    <div class="buyerOpenUidlink" v-if="params.value">
        <span @click="buyerOpenUidlink(params)">{{ params.value }}<Icon type="ios-search" style="color: var(--primary-color);font-size: 20px;font-weight:600;" /></span>
          <!-- <img title="点击搜索该买家订单" style='width: 22px;vertical-align: middle;margin-top: 0px;' class='wangwangIcon' border="0" src='../../assets/image/searchOrder.png'/></span> -->
    </div>
  </template>
   <script type="text/ecmascript-6">
    // 折叠面板组件
    const R3 = window.R3;
  
    const { network, urlSearchParams, store } = R3;
    export default {
      name: '',
      props: {
        params: {
          type: Object,
          default: () => ({})
        }
      },
      data() {
        return {
        };
      },
      created() {
            // this.getFormData()
        },
      methods: {
        // async getFormData() {
        //     const dom = document.querySelector(".ListsForm-box");
        //     if (dom) {
        //         const vm = dom.__vue__
        //         const data = await vm.getFormData();
        //         this.formData = data
        //     }
        // },
        buyerOpenUidlink(params) {
            // const dom = document.querySelector(".ListsForm-box");
            // this.formData.ORDERDATE = ''
            // this.formData.BUYER_OPEN_UID = params.value
            // if (dom) {
            //     const vm = dom.__vue__
            //     // this.formData = data
            //     vm.setFormData(this.formData)
            // }
            const tableName = 'T_V_OMSONLINEORDER';
            // 1、先关闭打开的 Tab 页
            this.tabClose(tableName);
            // 2、再打开 Tab 页
            setTimeout(()=>{
              window.parent.R3.store.commit('global/tabOpen', {
                type: 'S',
                tableName,
                tableId: '10883',
                isSetQuery: true,
                queryData: {
                  values: [
                    {
                      display: 'text',
                      colid: '205203',
                      defaultValue: params.value
                    },
                    {   // ORDERDATE(下单时间)
                      display: 'OBJ_DATE',
                      colid: '196269',
                      defaultValue:  null
                    },
                  ]
                }
              });
            }, 10);
        },
        tabClose(tableName) {
            let tabs = window.parent.vm.$store.state.global.openedMenuLists.filter((p) => p.tableName == tableName);
            if (tabs.length > 0) {
            const tab = tabs[0];
            const fullPath = tab.routeFullPath;
            const keepAliveModuleName = tab.keepAliveModuleName;
            const tableName = tab.tableName;

            window.parent.R3.store.commit('global/tabCloseAppoint',
                {
                routeFullPath: fullPath, // 当前路由fullPath
                stopRouterPush: false, // 是否阻止默认跳转到前一个tab
                keepAliveModuleName, // 当前模块名称
                tableName, // 当前自定义表标识
                event() { }, // type:function;调用方法前执行的回调
                });
            }
        },   
      }
    };
  </script>
  <style lang="scss">
    .markBox.tooltipMarkBox {
      margin-bottom: 6px;
    }
    .markBox.tooltipMarkBox .ark-form-item {
      display: flex;
      align-items: center;
      margin-bottom: -8px !important;
      .ark-form-item-content {
        width: 100%;
        max-width: 600px;
        margin-left: 0px !important;
      }
    }
    .markBox.tooltipMarkBox textarea.ark-input {
      height: 26px;
    }
    .platformorderPop .ark-tooltip {
      width: 100%;
    }
    .platformorderPop .ark-tooltip-inner {
      max-width: 600px;
    }
    .getListReturnTable.ark-table-wrapper {
      border: none !important;
      margin-top: -10px;
    }
    .getListReturnTable .ark-table tr {
      border-left: 1px solid #eee;
      border-right: 1px solid #eee;
    }
    .getListReturnTable .ark-table:before {
      content: unset;
      height: 0px !important;
    }
    .getListReturnTable .ark-table:after {
      content: unset;
      width: 0px !important;
    }
  </style>
  <style lang="scss" scoped>
    .leftTop {
      display: flex;
      align-items: center;
      justify-content: space-between;
      color: #909399;
      .ACTUALAMOUNT {
        color: #FD8B2E;
        font-size: 16px;
      }
      .topTip {
        color: #D0021B;
      }
    }
    .markBox.tooltipMarkBox {
      margin-top: -34px;
    }
    // .getListReturnTable {
    //   margin: 8px 0;
    // }
  </style>
  