<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item :label="$t('business.agent.agentRegister.account')" prop="account" label-width="auto">
        <el-input
          v-model="queryParams.account"
          :placeholder="$t('business.agent.agentRegister.placeholder.account')"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('business.agent.agentRegister.phone')" prop="phone" label-width="auto">
        <el-input
          v-model="queryParams.phone"
          :placeholder="$t('business.agent.agentRegister.placeholder.phone')"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item :label="$t('business.agent.agentRegister.userLevel')" prop="userLevel" label-width="auto">
        <el-select v-model="queryParams.userLevel" size="medium"
                   :placeholder="$t('business.agent.agentRegister.placeholder.userLevel')">
          <el-option
            v-for="item in options_userLevel"
            :key="item.value"
            :label="item.label"
            :value="item.value">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">{{
            $t('common.button.search')
          }}
        </el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('common.button.reset') }}</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['business:userRegister:add']"
        >{{ $t('common.button.add') }}
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['business:userRegister:edit']"
        >{{ $t('common.button.edit') }}
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['business:userRegister:remove']"
        >{{ $t('common.button.delete') }}
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['business:userRegister:export']"
        >{{ $t('common.button.export') }}
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="userRegisterList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column :label="$t('business.agent.agentRegister.account')" align="center" prop="account"/>
      <el-table-column :label="$t('business.agent.agentRegister.agentName')" align="center" prop="agentName"/>
      <el-table-column :label="$t('business.agent.agentRegister.status')" align="center" prop="status">
        <template slot-scope="scope">
          <el-tag type="primary" v-if="scope.row.status == '0'">
            {{ $t('business.agent.agentRegister.statusOption.initiated') }}
          </el-tag>
          <el-tag type="warning" v-if="scope.row.status == '1'">
            {{ $t('business.agent.agentRegister.statusOption.rejected') }}
          </el-tag>
          <el-tag type="success" v-if="scope.row.status == '2'">
            {{ $t('business.agent.agentRegister.statusOption.passed') }}
          </el-tag>
          <el-tag type="danger" v-if="scope.row.status == '3'">{{
              $t('business.agent.agentRegister.statusOption.frozen')
            }}
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column :label="$t('business.agent.agentRegister.userType')" align="center" prop="userType">
        <template slot-scope="scope">
          <el-tag type="success" v-if="scope.row.userType == '0'">
            {{ $t('business.agent.agentRegister.userTypeOption.normal') }}
          </el-tag>
          <el-tag type="warning" v-if="scope.row.userType == '1'">
            {{ $t('business.agent.agentRegister.userTypeOption.business') }}
          </el-tag>
          <el-tag type="warning" v-if="scope.row.userType == '2'">
            {{ $t('business.agent.agentRegister.userTypeOption.agent') }}
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column :label="$t('business.agent.agentRegister.userLevel')" align="center" prop="userLevel">
        <template slot-scope="scope">
          <span v-if="scope.row.userLevel == '0'">{{ $t('business.agent.agentRegister.userLevelOption.normal') }}</span>
          <span v-if="scope.row.userLevel == '1'">{{ $t('business.agent.agentRegister.userLevelOption.vip') }}</span>
          <span v-if="scope.row.userLevel == '2'">{{
              $t('business.agent.agentRegister.userLevelOption.business')
            }}</span>
        </template>
      </el-table-column>
      <el-table-column :label="$t('business.agent.agentRegister.phone')" align="center" prop="phone"/>
      <el-table-column :label="$t('business.agent.agentRegister.contactAddress')" align="center" prop="contactAddress"/>
      <el-table-column :label="$t('common.tableMsg.operation')" align="center" width="200"
                       class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button v-if="(scope.row.agentName == '' || scope.row.agentName == null)"
                     size="mini"
                     type="text"
                     icon="el-icon-document-add"
                     @click="handleAddInfo(scope.row)"
          >{{ $t('business.agent.agentRegister.button.supplement') }}
          </el-button>
          <el-button v-if="(scope.row.agentName != '' && scope.row.agentName != null)"
                     size="mini"
                     type="text"
                     icon="el-icon-view"
                     @click="handleDetail(scope.row)"
          >{{ $t('common.button.detail') }}
          </el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['business:userRegister:edit']"
          >{{ $t('common.button.edit') }}
          </el-button>
          <el-dropdown>
            <span class="el-dropdown-link">
              {{ $t('common.button.more') }}<i class="el-icon-arrow-down el-icon--right"></i>
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-refresh"
                  @click="passwordReset(scope.row)"
                  v-hasPermi="['business:userRegister:edit']"
                >{{ $t('business.agent.agentRegister.button.passwordReset') }}
                </el-button>
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button v-if="(scope.row.status != '3')"
                           size="mini"
                           type="text"
                           icon="el-icon-lock"
                           @click="accountLock(scope.row)"
                           v-hasPermi="['business:userRegister:edit']"
                >{{ $t('business.agent.agentRegister.button.accountLock') }}
                </el-button>
                <el-button v-if="(scope.row.status == '3')"
                           size="mini"
                           type="text"
                           icon="el-icon-unlock"
                           @click="accountUnlock(scope.row)"
                           v-hasPermi="['business:userRegister:edit']"
                >{{ $t('business.agent.agentRegister.button.accountUnlock') }}
                </el-button>
              </el-dropdown-item>
              <el-dropdown-item>
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-delete"
                  @click="handleDelete(scope.row)"
                  v-hasPermi="['business:userRegister:remove']"
                >{{ $t('common.button.delete') }}
                </el-button>
              </el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改用户注册对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="auto">
        <el-form-item :label="$t('business.agent.agentRegister.account')" prop="account">
          <el-input v-model="form.account" :placeholder="$t('business.agent.agentRegister.placeholder.name')"/>
        </el-form-item>
        <el-form-item :label="$t('business.agent.agentRegister.phone')" prop="phone">
          <el-input v-model="form.phone" :placeholder="$t('business.agent.agentRegister.placeholder.phone')"/>
        </el-form-item>
        <el-form-item :label="$t('business.agent.agentRegister.userType')" prop="userType">
          <el-select v-model="form.userType" :placeholder="$t('business.agent.agentRegister.placeholder.userType')">
            <el-option
              v-for="item in options_userType"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('business.agent.agentRegister.userLevel')" prop="userLevel">
          <el-select v-model="form.userLevel" size="medium"
                     :placeholder="$t('business.agent.agentRegister.placeholder.userLevel')">
            <el-option
              v-for="item in options_userLevel"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitForm">{{
            $t('common.button.confirm')
          }}
        </el-button>
        <el-button @click="cancel">{{ $t('common.button.cancel') }}</el-button>
      </div>
    </el-dialog>

    <!-- 添加或修改代理商信息 -->
    <el-dialog :title="title" :visible.sync="openInfoAgent" width="700px" append-to-body>
      <el-form ref="formInfoAgent" :model="formInfoAgent" :rules="rules" label-width="auto">
        <el-form-item :label="$t('business.agent.agentRegister.agentName')" prop="agentName">
          <el-input v-model="formInfoAgent.agentName"
                    :placeholder="$t('business.agent.agentRegister.placeholder.agentName')"/>
        </el-form-item>
        <el-form-item :label="$t('business.userManager.userInfo.email')" prop="email">
          <el-input v-model="formInfoAgent.email" :placeholder="$t('business.userManager.userInfo.emailPlaceholder')"/>
        </el-form-item>
        <el-form-item :label="$t('business.merchant.indexBus.operateTypeLabel')" prop="operateType">
          <el-select v-model="formInfoAgent.operateType"
                     :placeholder="$t('business.merchant.indexBus.operateTypePlaceholder')">
            <el-option
              v-for="item in options_operateType"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('business.merchant.indexBus.addr')" prop="contactAddress">
          <el-cascader
            v-model="formInfoAgent.contactAddress"
            :options="options_addr"
            @change="handleChange"></el-cascader>
        </el-form-item>
        <el-form-item :label="$t('business.userManager.userInfo.detailAddr')" prop="detail">
          <el-input v-model="formInfoAgent.detail" :placeholder="$t('business.userManager.userInfo.addrPlaceholder')" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button :loading="buttonLoading" type="primary" @click="submitFormInfoAgent">{{
            $t('common.button.confirm')
          }}
        </el-button>
        <el-button @click="cancel">{{ $t('common.button.cancel') }}</el-button>
      </div>
    </el-dialog>

    <!--    用户注册详情-代理商-->
    <el-dialog :title="title" :visible.sync="detailOpenAgent" width="700px" append-to-body>
      <el-form ref="formDetailAgent" :model="formDetailAgent" label-width="auto">
        <el-form-item :label="$t('business.agent.agentRegister.account')">
          {{ formDetailAgent.account }}
        </el-form-item>
        <el-form-item :label="$t('business.agent.agentRegister.agentName')">
          {{ formDetailAgent.userInfoAgentVo.agentName }}
        </el-form-item>
        <el-form-item :label="$t('business.userManager.userInfo.email')">
          {{ formDetailAgent.userInfoAgentVo.email}}
        </el-form-item>
        <el-form-item :label="$t('business.merchant.indexBus.operateTypeLabel')">
          <el-select v-model="formDetailAgent.userInfoAgentVo.operateType" disabled="disabled">
            <el-option
              v-for="item in options_operateType"
              :key="item.value"
              :label="item.label"
              :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="$t('business.merchant.indexBus.contactAddress')">
          {{ formDetailAgent.userInfoAgentVo.contactAddress }}
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">{{ $t('common.button.close') }}</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  getUserRegister,
  delUserRegister,
  addUserRegister,
  updateUserRegister,
  resetUserPassword,
  accountLock,
  listUserRegisterAgent, addUserInfoAgen, getAddress
} from "@/api/business/userRegister";

export default {
  name: "UserRegister",
  data() {
    return {
      // 按钮loading
      buttonLoading: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 用户注册表格数据
      userRegisterList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 是否显示详情弹出层-代理商
      detailOpenAgent: false,
      // 是否展示用户信息弹窗层-个人
      openInfoAgent: false,
      // 是否展示用户信息弹窗层-商企
      openInfoBus: false,
      //地址选择列表
      options_addr:[],
      //经营类别
      options_operateType: [{
        value: '0',
        label: this.$t('common.operateType.type0')
      }, {
        value: '1',
        label: this.$t('common.operateType.type1')
      },{
        value: '2',
        label: this.$t('common.operateType.type2')
      },{
        value: '3',
        label: this.$t('common.operateType.type3')
      },{
        value: '4',
        label: this.$t('common.operateType.type4')
      },{
        value: '5',
        label: this.$t('common.operateType.type5')
      },{
        value: '6',
        label: this.$t('common.operateType.type6')
      },{
        value: '7',
        label: this.$t('common.operateType.type7')
      },{
        value: '8',
        label: this.$t('common.operateType.type8')
      },{
        value: '9',
        label: this.$t('common.operateType.type9')
      },{
        value: '10',
        label: this.$t('common.operateType.type10')
      },{
        value: '11',
        label: this.$t('common.operateType.type11')
      },{
        value: '12',
        label: this.$t('common.operateType.type12')
      },{
        value: '13',
        label: this.$t('common.operateType.type13')
      },{
        value: '14',
        label: this.$t('common.operateType.type14')
      },{
        value: '15',
        label: this.$t('common.operateType.type15')
      },{
        value: '16',
        label: this.$t('common.operateType.type16')
      },{
        value: '17',
        label: this.$t('common.operateType.type17')
      },],
      options_operateStatus: [{
        value: '存续',
        label: this.$t('business.agent.agentRegister.operateStatusOption.continued')
      }, {
        value: '注销',
        label: this.$t('business.agent.agentRegister.operateStatusOption.cancelled')
      }],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        userId: undefined,
        account: undefined,
        phone: undefined,
        passwd: undefined,
        status: undefined,
        userType: undefined,
        userLevel: undefined,
      },
      // 表单参数
      form: {
        userInfoVo: {},
        userInfoBusVo: {}
      },
      // 用户详情表单参数-商企
      formDetailAgent: {
        userInfoAgentVo: {}
      },
      // 用户信息表单参数-代理
      formInfoAgent: {},
      // 表单校验
      rules: {
        account: [
          {required: true, message: this.$t('business.agent.agentRegister.rule.agentNameRequired'), trigger: "blur"}
        ],
        userType: [
          {required: true, message: this.$t('business.agent.agentRegister.rule.userTypeRequired'), trigger: "blur"}
        ],
        userLevel: [
          {required: true, message: this.$t('business.agent.agentRegister.rule.userLevelRequired'), trigger: "blur"}
        ],
        legalPerson: [
          {required: true, message: this.$t('business.agent.agentRegister.rule.legalPersonRequired'), trigger: "blur"}
        ],
        operateType: [
          {required: true, message: this.$t('business.merchant.indexBus.operateTypeRequired'), trigger: "change"}
        ],
        email: [
          { required: true, pattern: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,}(?:\.[a-zA-Z]{2,})?$/, message: this.$t('business.userManager.userInfo.emailRequired'), trigger: "blur" }
        ],
        detail: [
          {required: true, message: this.$t('business.merchant.indexBus.contactAddressRequired'), trigger: "blur"}
        ],
        operateStatus: [
          {
            required: true,
            message: this.$t('business.agent.agentRegister.rule.operateStatusRequired'),
            trigger: "change"
          }
        ],
        operateAddr: [
          {required: true, message: this.$t('business.agent.agentRegister.rule.operateAddrRequired'), trigger: "blur"}
        ],
        agentName: [
          {required: true, message: this.$t('business.agent.agentRegister.rule.agentNameRequired'), trigger: "blur"}
        ],
        idCard: [
          {
            required: true,
            pattern: /^\d+$/,
            message: this.$t('business.agent.agentRegister.rule.idCardInvalid'),
            trigger: "blur"
          }
        ],
        phone: [
          {
            required: true,
            pattern: /^\d+$/,
            message: this.$t('business.agent.agentRegister.rule.phoneInvalid'),
            trigger: "blur"
          }
        ],
        age: [
          {
            required: true,
            pattern: /^\d+$/,
            message: this.$t('business.agent.agentRegister.rule.ageInvalid'),
            trigger: "blur"
          }
        ],
        contactAddress: [
          {
            required: true,
            message: this.$t('business.agent.agentRegister.rule.contactAddressRequired'),
            trigger: "blur"
          }
        ],
      },
      options_userType: [{
        value: '2',
        label: this.$t('business.agent.agentRegister.userTypeOption.agent')
      }],
      options_userLevel: [{
        value: '0',
        label: this.$t('business.agent.agentRegister.userLevelOption.normal')
      }, {
        value: '1',
        label: this.$t('business.agent.agentRegister.userLevelOption.vip')
      }, {
        value: '2',
        label: this.$t('business.agent.agentRegister.userLevelOption.business')
      }]
    };
  },
  created() {
    this.getList();
    this.getAddress();
  },
  methods: {
    /** 查询用户注册列表 */
    getList() {
      this.loading = true;
      const languageMap = {
        'zh': 1,
        'en': 2,
        'la': 3
      };
      this.queryParams.language = languageMap[this.$i18n.locale] || null;
      listUserRegisterAgent(this.queryParams).then(response => {
        this.userRegisterList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.detailOpenAgent = false;
      this.openInfoAgent = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: undefined,
        userId: undefined,
        account: undefined,
        phone: undefined,
        passwd: undefined,
        status: undefined,
        delFlag: undefined,
        userType: undefined,
        createBy: undefined,
        createTime: undefined,
        updateBy: undefined,
        updateTime: undefined
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = this.$t('business.agent.agentRegister.addTitle');
    },
    /** 详情按钮操作 */
    handleDetail(row) {
      this.loading = true;
      this.reset();
      const id = row.id || this.ids
      getUserRegister(id).then(response => {
        this.loading = false;
        this.formDetailAgent = response.data;
        this.detailOpenAgent = true;
        this.title = this.$t('business.agent.agentRegister.detailTitle');
      });
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.loading = true;
      this.reset();
      const id = row.id || this.ids
      getUserRegister(id).then(response => {
        this.loading = false;
        this.form = response.data;
        this.open = true;
        this.title = this.$t('business.agent.agentRegister.editTitle');
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.buttonLoading = true;
          if (this.form.id != null) {
            updateUserRegister(this.form).then(response => {
              this.$modal.msgSuccess(this.$t('business.agent.agentRegister.editSuccess'));
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          } else {
            addUserRegister(this.form).then(response => {
              this.$modal.msgSuccess(this.$t('business.agent.agentRegister.addSuccess'));
              this.open = false;
              this.getList();
            }).finally(() => {
              this.buttonLoading = false;
            });
          }
        }
      });
    },
    /** 用户信息-提交按钮-代理商 */
    submitFormInfoAgent() {
      this.$refs["formInfoAgent"].validate(valid => {
        if (valid) {
          this.formInfoAgent.contactAddress = this.formInfoAgent.contactAddress + "," + this.formInfoAgent.detail;
          addUserInfoAgen(this.formInfoAgent).then(response => {
            this.$modal.msgSuccess(this.$t('common.addSuccess'));
            this.openInfoAgent = false;
            this.getList();
          }).finally(() => {
            this.buttonLoading = false;
          });
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const account = row.account;
      const ids = row.id || this.ids;
      var msg = "";
      if (null != account)
        msg = this.$t('business.agent.agentRegister.deleteConfirmSingle', {account: account});
      else
        msg = this.$t('business.agent.agentRegister.deleteConfirmBatch');
      this.$modal.confirm(msg).then(() => {
        this.loading = true;
        return delUserRegister(ids);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess(this.$t('business.agent.agentRegister.deleteSuccess'));
      }).catch(() => {
      }).finally(() => {
        this.loading = false;
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('business/userRegister/export', {
        ...this.queryParams
      }, `userRegister_${new Date().getTime()}.xlsx`)
    },
    handleAddInfo(row) {
      this.reset();
      this.formInfoAgent = row;
      this.openInfoAgent = true;
      this.title = this.$t('business.agent.agentRegister.supplementTitle');
    },

    /**
     * 密码重置
     * @param row
     */
    passwordReset(row) {
      this.$modal.confirm(this.$t('business.agent.agentRegister.passwordResetConfirm')).then(() => {
        this.loading = true;
        return resetUserPassword(row.id);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess(this.$t('business.agent.agentRegister.passwordResetSuccess'));
      }).catch(() => {
      }).finally(() => {
        this.loading = false;
      });
    },

    /**
     * 账号冻结
     * @param row
     */
    accountLock(row) {
      this.$modal.confirm(this.$t('business.agent.agentRegister.accountLockConfirm', {account: row.account})).then(() => {
        this.loading = true;
        return accountLock(row);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess(this.$t('business.agent.agentRegister.accountLockSuccess'));
      }).catch(() => {
      }).finally(() => {
        this.loading = false;
      });
    },
    /**
     * 账号解冻
     * @param row
     */
    accountUnlock(row) {
      this.$modal.confirm(this.$t('business.agent.agentRegister.accountUnlockConfirm', {account: row.account})).then(() => {
        this.loading = true;
        return accountLock(row);
      }).then(() => {
        this.loading = false;
        this.getList();
        this.$modal.msgSuccess(this.$t('business.agent.agentRegister.accountUnlockSuccess'));
      }).catch(() => {
      }).finally(() => {
        this.loading = false;
      });
    },
    /** 获取地址列表 */
    getAddress() {
      this.loading = true;
      getAddress(this.$i18n.locale).then(response => {
        this.options_addr = response.data;
      });
    },
    /** 地址联动事件 **/
    handleChange(value) {
      this.formInfo.addr = value;
    }
  }
};
</script>

<style>
.el-dropdown-link {
  cursor: pointer;
  color: #409EFF;
}

.el-icon-arrow-down {
  font-size: 12px;
}
</style>
