personalInfo.vue 5.86 KB
<!-- 个人信息 -->
<template>
  <d2-container class="personalInfo">
    <div class="d2-container-content">
      <p class="title">
        个人信息
      </p>
      <el-form>
        <template v-for="(item, index) in (formData.userType == 2 ? userformList : formList)">
          <el-form-item
            :key="index"
            :label="item.label"
            label-width="120px"
            v-show="!item.hasOwnProperty('isDisabled') || formData[item.isDisabled]">
            <template v-if="item.type === 'photo'">
              <img
                class="info-img"
                v-for="(subItem, subIndex) in formData[item.name]"
                :key="subIndex"
                :src="subItem.fileUrl">
            </template>
            <template v-else-if="Array.isArray(formData[item.name])">
              <el-tag
                class="tag"
                type="warning"
                v-for="(subItem, subIndex) in formData[item.name]"
                :key="subIndex">
                {{ item.attrName ? subItem.brandName : subItem }}
              </el-tag>
            </template>
            <span v-else-if="item.formatter">{{ item.formatter(formData) }}</span>
            <span v-else-if="item.parentName">{{ formData[item.parentName][item.name] }}</span>
            <span v-else>{{ formData[item.name] }}</span>
          </el-form-item>
        </template>
        <el-form-item v-if="formData.userType != 2">
          <a
            class="info-link"
            href="http://dj.glsx.com.cn/web-dj-site/#/system/personallnfo"
            target="_blank">修改个人信息请到嘀加平台,点击快速修改</a>
        </el-form-item>
        <el-form-item v-if="formData.userType != 2">
          <a
            class="info-link"
            href="https://sso.glsx.com.cn/#/login"
            target="_blank">修改账户权限请到运营平台,点击快速修改</a>
        </el-form-item>
      </el-form>
    </div>
  </d2-container>
</template>

<script>
import { getUserInfo } from '@api/personalInfo'
export default {
  name: 'PersonalInfo',
  data() {
    return {
      formData: {},
      formList: [{
        name: 'loginAccout',
        label: '登录账户'
      }, {
        name: 'merchantLegalPersonPhone',
        label: '登录手机号'
      }, {
        name: 'merchantNo',
        label: '商户号'
      }, {
        name: 'merchantName',
        label: '商户全称'
      }, {
        name: 'merchantAbbreviation',
        label: '商户简称'
      }, {
        name: 'accountTypeNames',
        label: '商户分类'
      }, {
        name: 'merchantAddress',
        label: '商户地址'
      }, {
        name: 'merchantLegalPersonPhone',
        label: '商户电话'
      }, {
        name: 'businessHours',
        label: '营业时间'
      }, {
        name: 'merchantFileResponses',
        label: '门店照片',
        type: 'photo'
      }, {
        name: 'merchantBrandName',
        label: '主营品牌'
        // attrName: 'brandName'
      }, {
        name: 'mainBusiness',
        label: '营业范围'
      }
      // , {
      //   parentName: 'role',
      //   name: 'name',
      //   label: '角色权限'
      // }
      ],
      userformList: [{
        name: 'loginAccout',
        label: '登录账户'
      }, {
        name: 'staffPhone',
        label: '登录手机号'
      }, {
        name: 'userName',
        label: '姓名/名称'
      }, {
        name: 'merchantName',
        label: '所属商户'
      }
      //  {
      //   parentName: 'role',
      //   name: 'name',
      //   label: '角色权限'
      // }, {
      //   name: 'isOpenCard',
      //   label: '名片',
      //   formatter: (cellValue) => {
      //     return cellValue.isOpenCard ? '开通' : '未开通'
      //   }
      // }, {
      //   name: 'duty',
      //   isDisabled: 'isOpenCard',
      //   label: '职务'
      // }, {
      //   name: 'photoHead',
      //   label: '头像',
      //   isDisabled: 'isOpenCard',
      //   type: 'photo'
      // }, {
      //   name: 'staffPhone',
      //   label: '电话',
      //   isDisabled: 'isOpenCard'
      // }, {
      //   name: 'wechatNum',
      //   label: '微信',
      //   isDisabled: 'isOpenCard'
      // }, {
      //   name: 'userLabelListArr',
      //   label: '标签',
      //   isDisabled: 'isOpenCard'
      // }
      ]
    }
  },

  mounted() {
    getUserInfo({}).then(res => {
      res.beSuper = res.loginAccount.isAdmin == 1
      res.detail = res.merchant
      Object.keys(res.loginAccount).forEach(item => {
        if (res.loginAccount[item] && !res.detail[item]) {
          res.detail[item] = res.loginAccount[item]
        }
      })
      this.formData = res.detail
      if (this.formData.userType != 2) {
        this.formData.businessHours = this.formData.bussinessBegintime + '-' + this.formData.bussinessEndtime
        this.formData.mainBusiness = this.formData.businessScopeCustomize ? (this.formData.businessScopName ? (this.formData.businessScopName + ',' + this.formData.businessScopeCustomize) : this.formData.businessScopeCustomize) : this.formData.businessScopName
      } else {
        this.formData.staffPhone = res.staff.staffPhone
        this.formData.photoHead = [{ mediaUrl: this.formData.photo }]
        // this.formData.userLabelListArr = this.formData.userLabelList.map(item => item.labelName)
      }
    })
  },

  methods: {}
}

</script>
<style>
.personalInfo .d2-container-content {
  margin-top: 0 !important;
}
.personalInfo .title {
  font-size: 22px;
  color: #666666;
  letter-spacing: 1.38px;
}
.personalInfo .info-img {
  width: 120px;
  height: 120px;
  margin-right: 5px;
}
.personalInfo .tag {
  margin-right: 10px;
  color: #333333;
  /* width: 20px;
  height: 20px;
  font-size: 14px;
  color: #333333;
  background: #fff8ef;
  border: 1px solid #ffdfb8;
  border-radius: 6px; */
}
.personalInfo .info-link {
  color: #003a00;
  cursor: pointer;
}
</style>