storeList.vue 6.66 KB
<!--
 * @Author: yangming yangming@didihu.com.cn
 * @Date: 2022-10-10 10:56:40
 * @LastEditors: 前端 qianduan01@didihu.com.cn
 * @LastEditTime: 2022-10-28 12:28:17
 * @FilePath: \scrm-micro-provider\src\views\home\components\activityList.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="srcm-main">
    <GLCombiForm :rowNumber="1" ref="formSearch" :formObj="tableSearchForm" :formData="searchFormData" @handleOk="handleSearch" @handleRest="handleReset"></GLCombiForm>
    <GLTable v-loading="loading" ref="table" :getListApi="getListApi" :searchForm="tableSearchForm" :tableParams="tableParams" :pageConf="pageConf" :beforeSearchFn="beforeSearchFn">
      <template slot="optionBtns" slot-scope="scope">
        <el-button type="text" v-if="scope.scope.status == 0" @click="handleSure(scope.scope)">确认账号已开通</el-button>
      </template>
      <template slot="status" slot-scope="scope">
        <div :class="['task_icon', `task_icon_${scope.scope.status == 1 ? 'green' : 'grey'}`]">{{ taskStatus(scope.scope.status) }}</div>
      </template>
    </GLTable>
    <GLDialog title="门店状态变更" :hasFooter="true" :visible.sync="openVisible">
      <div class="dialog-body-panel">
        <div class="dialog-tips">请确认该门店账号已开通?</div>
        <div class="dialog-body-form">
          <label>输入已开通门店商户号:</label>
          <div class="dialog-body-content">
            <div class="body-input flex-center-align">
              <el-input size="small" type="text" v-model="merchantId" @blur="handleBlur" @change="loadingM = false"></el-input>
              <img v-if="merchantDetail.merchantName" src="@/assets/image/icon-check.png" />
            </div>

            <div class="input-tips" v-if="merchantDetail.merchantName">门店名称:{{ merchantDetail.merchantName }}</div>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button size="small" @click="openVisible = false">取消</el-button>
        <el-button size="small" type="primary" @click="handleOpen">已开通</el-button>
      </span>
    </GLDialog>
  </div>
</template>
<script>
import mixi from '@/mixins'
export default {
  name: 'storeList',
  mixins: [mixi],
  data() {
    return {
      loadingM: false,
      merchantId: '',
      merchantDetail: {},
      selectStore: '',
      getListApi: this.$apis.application.merchantPage,
      tableSearchForm: {},
      searchFormData: [
        {
          label: '服务商名称',
          name: 'serviceMerchantName',
          type: 'input'
        },
        {
          label: '服务商号',
          name: 'serviceMerchantId',
          type: 'input'
        },
        {
          label: '开通门店',
          name: 'applyMerchantName',
          type: 'input'
        },
        {
          label: '状态',
          name: 'status',
          type: 'select',
          placeholder: '请选择',
          optionId: 'value',
          optionLabel: 'label',
          optionList: []
        }
      ],
      tableParams: {
        listName: 'data',
        tableOption: false,
        tableColumns: [
          {
            label: '服务商名称',
            prop: 'serviceMerchantName',
            minwidth: 120
          },
          {
            label: '服务商商号',
            prop: 'serviceMerchantId',
            width: '120px'
          },
          {
            label: '手机号码',
            prop: 'serviceMerchantPhone',
            width: '150px'
          },
          {
            label: '开通门店名称',
            prop: 'applyMerchantName',
            width: 200,
            line: 1
          },
          {
            label: '门店联系人',
            prop: 'merchantContact',
            width: '220px'
          },
          {
            label: '门店联系手机',
            prop: 'phone',
            width: '150px'
          },
          {
            label: '状态',
            prop: 'status',
            width: '120px',
            addHtml: 'status'
          },
          {
            label: '申请时间',
            prop: 'createdTime',
            width: '180px'
          },
          {
            label: '操作',
            prop: 'optionBtns',
            width: '140px',
            addHtml: 'optionBtns',
            fixed: 'right'
          }
        ]
      },
      openVisible: false
    }
  },
  methods: {
    handleSure(scope) {
      this.openVisible = true
      this.selectStore = scope
      this.merchantId = ''
      this.merchantDetail = {}
    },
    async handleOpen() {
      if (!this.loadingM) {
        await this.handleBlur()
      }
      const { merchantName } = this.merchantDetail
      if (!merchantName) {
        this.$message.error('商户号错误')
        return
      }
      const { merchantId } = this
      const { phone, id } = this.selectStore
      this.$apis.application.merchantConfirm({ merchantName, merchantId, phone, id }).then(res => {
        if (res) {
          this.$message.success('操作成功')
          this.openVisible = false
          this.handleSearch()
        }
      })
    },
    handleBlur() {
      const { merchantId } = this
      return new Promise(resolve => {
        if (!merchantId) {
          this.merchantDetail = {}
          return
        }
        this.$apis.application.findMerchantDetailByMerchantNo({ merchantId }).then(res => {
          resolve()
          this.loadingM = true
          this.merchantDetail = res || {}
        })
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.srcm-main {
  padding: 16px;
  background: #fff;
  min-height: calc(100vh - 174px);
  .task_icon {
    position: relative;
    &::after {
      content: '';
      position: absolute;
      top: 4px;
      left: -10px;
      width: 6px;
      height: 6px;
      border-radius: 4px;
    }
    &.task_icon_grey {
      &::after {
        background: #999;
      }
    }
    &.task_icon_green {
      &::after {
        background: #2cca74;
      }
    }
  }
  .dialog-tips {
    font-weight: 600;
    font-size: 16px;
    color: #333333;
  }
  .dialog-body-form {
    display: flex;
    margin-top: 20px;
    label {
      line-height: 32px;
    }
    .dialog-body-content {
      flex: 1;
      img {
        width: 20px;
      }
      /deep/ {
        .el-input,
        .el-date-editor {
          width: 284px;
        }
      }
      .input-tips {
        height: 40px;
        line-height: 40px;
        background: #f9f9f9;
        padding: 0px 6px;
        box-sizing: border-box;
        margin-top: 6px;
        width: 80%;
      }
    }
  }
}
</style>