merchantAdmin.vue 3.74 KB
<!-- 商户管理员 -->
<template>
  <div>
    <!-- <d2-container> -->
    <div class="d2-container-content">
      <d2-table ref="recordTable" :get-list-api="getListApi" :search-form="searchFormSearch" :table-params="tableParams"
                :before-search-fn="beforeSearchFn" :has-page="false">
      </d2-table>
    </div>
    <!-- </d2-container> -->

  </div>
</template>

<script>
import { sendSms, getAdminInfo } from '@api/merchant'
import { Util, deepClone } from '@/common/util'
import { mapActions, mapState } from 'vuex'
import { listYqRefConfig } from '@/api/shopConfig.js'
export default {
  name: 'MerchantAdmin',
  components: {

  },
  data() {
    return {
      userInfo: this.$store.state.d2admin.user.info,
      searchForm: {

      },
      searchFormSearch: {},
      showFormData: [],
      getListApi: listYqRefConfig,
      tableParams: {
        btnId: new Date().getTime() + parseInt(Math.random() * 1000),
        listName: 'list',
        tableOption: false,
        tableColumns: [{
          label: '商户',
          prop: 'merchantName'
        }, {
          label: '联系人',
          prop: 'merchantLegalPerson'
        }, {
          label: '手机号',
          prop: 'merchantLegalPersonPhone'
        }, {
          label: '关联场景',
          prop: 'sceneStr'
        }, {
          label: '更新时间',
          prop: 'updatedTime',
          formatter: (cellValue) => {
            return cellValue.updatedTime ? Util.dateFormate(cellValue.updatedTime, 'YYYY-MM-DD HH:mm:ss') : ''
          }
        }
        ]
      },
      // 短信模块
      isSend: false,
      sendMsg: '发送验证短信',
      adminInfo: {
        name: '',
        phone: ''
      },
      rules: {
        smsCode: [{ required: true, message: '请输入验证码', trigger: 'blur' }]
      },
      isShowOkbtn: true,
      num: 0
    }
  },
  computed: {
    ...mapState({
      dowloadList: (state) => state.d2admin.user.dowloadList
    })
  },
  props: {
    info: {
      type: Object,
      default: () => { }
    }
  },
  mounted() {
    getAdminInfo({}).then(res => {
      this.adminInfo = res
    })
    // this.getBaseData()
  },

  methods: {
    ...mapActions({
      get: 'd2admin/base/get',
      close: 'd2admin/page/close'
    }),
    ...mapActions('d2admin/user', ['actionSetDownloadList']),

    // async getBaseData() {
    //   this.getOptionsList()
    // },
    // 短信模块-start
    handleSend() {
      sendSms({}).then((res) => {
        this.notice.okTips('已发送,30分钟内有效')
        this.isSend = true
        this.sendMsg = 60
        this.msgDown()
      })
    },
    msgDown() {
      var time = setTimeout(() => {
        clearTimeout(time)
        if (this.sendMsg > 1) {
          --this.sendMsg
          this.msgDown()
        } else {
          this.isSend = false
        }
      }, 1000)
    },
    // 短信模块-end
    beforeSearchFn() {
      return new Promise(resolve => {
        this.searchFormSearch = deepClone(this.searchForm)
        this.searchFormSearch.merchantId = this.info.merchantId
        resolve()
      })
    }

    // getOptionsList() {
    //   this.showFormData.forEach((item, index) => {
    //     if (item.type === 'select') {
    //       if (this.baseData[item.optionsName].length && this.baseData[item.optionsName][0][this.showFormData[index].optionLabel] !== '全部') {
    //         const temp = {}
    //         temp[this.showFormData[index].optionId] = ''
    //         temp[this.showFormData[index].optionLabel] = '全部'
    //         this.baseData[item.optionsName].unshift(temp)
    //       }
    //       this.$set(this.showFormData[index], 'optionList', this.baseData[item.optionsName])
    //     }
    //   })
    // },

  }
}

</script>
<style lang="scss" scoped></style>