storeInfo.vue 6.37 KB
<template>
  <d2-container class="customer-tags">
    <div class="d2-container-content">
      <d2-table-header title="门店列表"> </d2-table-header>
      <d2-table
        :hasPage="hasPage"
        ref="storeTable"
        :tableData="tableData"
        :search-form="searchForm"
        :table-params="tableParams"
      >
        <div slot="mainBrand" slot-scope="scope">
          <template
            v-if="
              scope.scope.mainBrand &&
              scope.scope.mainBrand.split(',').length > 1
            "
          >
            <span>{{
              scope.scope.mainBrand.split(",").slice(0, 1).join("")
            }}</span>
            <el-popover placement="top" width="fit-content" trigger="hover">
              <div
                :class="{
                  serverHeight: scope.scope.mainBrand.split(',').length >= 10
                }"
              >
                <div
                  v-for="(item, index) in scope.scope.mainBrand.split(',')"
                  :key="index"
                >
                  {{ item }}
                </div>
              </div>
              <span class="more-info" slot="reference"
                >...({{ scope.scope.mainBrand.split(",").length }})</span
              >
            </el-popover>
          </template>
          <template v-else>
            <span>{{
              scope.scope.mainBrand ? scope.scope.mainBrand : "--"
            }}</span>
          </template>
        </div>
      </d2-table>
    </div>
  </d2-container>
</template>

<script type="text/ecmascript-6">
import { Util, deepClone } from "@/common/util"
import {
  findStoreInfoByMerchantNo
} from "@api/serviceCentre"
import { long_businessOpt } from "@/common/constants.js"
import noDataImg from "@/assets/empty.png"
import dayjs from "dayjs"
export default {
  name: "storreInfo",
  data() {
    return {
      hasPage:false,
      listOfPenaltiesShow: false,
      noDataImg,
      searchForm: {
        scene: "",
        merchantNos: []
      },
      tableData:[],
      baseData: {
        directOperateOpt: [
          { confId: 0, confValue: "非直营" },
          { confId: 1, confValue: "直营" }
        ],
        businessOpt:long_businessOpt,
      },
      // 表格参数
      tableParams: {
        listName: "list",
        tableColumns: [
          {
            label: "门店名称",
            prop: "storeName"
          },
          {
            label: "商户号",
            prop: "merchantNo"
            // minWidth: 144,
          },
          {
            label: "是否直营",
            formatter: (cellValue) => {
              return this.baseData.directOperateOpt.find(
                (item) => item.confId === cellValue.isDirectOperated
              )?.confValue
            }
          },
          {
            label: "展业时间",
            prop: "businessDevDate",
            formatter: (cellValue) => {
              return cellValue.businessDevDate
                ? Util.dateFormate(cellValue.businessDevDate, "YYYY-MM-DD")
                : ""
            }
          },
          {
            label: "归属业务",
            formatter: (cellValue) => {
              return this.baseData.businessOpt.find(
                (item) => item.confId ==this.queryData.scene
              )?.confValue
            }
          },
          {
            label: "主营品牌",
            prop: "mainBrand",
            addHtml: "mainBrand"
          },
          {
            label: "区域运营经理",
            prop: "regionalManager",
          },
          {
            label: "驻店人数",
            prop: "staffCount",
          },
          {
            label: "已配课程人数",
            prop: "courseConfiguredCount",
          }
        ]
      }
    }
  },

  props: {
    queryData: {
      type: Object,
      default: () => {}
    }
  },
  watch: {
    queryData: {
      handler(val) {
        setTimeout(() => {
          this.findStoreInfoByMerchantNoData()
        }, 0)

      },
      deep: true,
      immediate: true
    }
  },
  mounted() {
    this.findStoreInfoByMerchantNoData()
  },

    methods: {
    findStoreInfoByMerchantNoData() {
      console.log(this.queryData, "queryData")
      this.searchForm.scene = this.queryData.scene
      this.searchForm.merchantNos = this.queryData.merchantNos
        ? this.queryData.merchantNos
        : []

      findStoreInfoByMerchantNo(this.searchForm).then((res) => {
        this.tableData = res
      })
    },


    //获取门店下的员工
    getStaffInfoData(merchantNos) {
      return new Promise((resolve, reject) => {
        findStaffByMerchantNo({
          merchantNos,
          scene: this.queryData.scene
        }).then((res) => {
          console.log(res)
          resolve(res)
        })
      })
    },
  }


}
</script>

<style scoped lang="scss">
.customer-tags {
  .d2-container-content {
    margin-top: 0 !important;
  }
}
.emptyBg {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 120px 0;

  .noDataImg {
    width: 64px;
    height: 40px;
  }
}

.error-input {
  ::v-deep.el-input__inner {
    border-color: red;
  }
}

.tag-item {
  display: flex;
  align-items: center;
  padding: 0 10px;
  justify-content: center;

  .tag {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .more-info {
    white-space: nowrap;
    color: #2a58ad;
    cursor: pointer;
    margin-left: 2px;
  }
}

::v-deep.tags-popover {
  max-width: 50vw;
}

.static-box {
  display: flex;
  gap: 0 16px;
  margin-bottom: 12px;

  .static-item {
    flex: 1;
    flex-shrink: 0;
    height: 82px;
    background: #f8faff;
    border-radius: 5px;
    box-sizing: border-box;
    padding: 16px 20px;

    .static-title {
      font-size: 14px;
      color: #333333;
      line-height: 20px;
      margin-bottom: 4px;
    }

    .static-value {
      display: flex;
      font-weight: 700;
      font-size: 24px;
      line-height: 30px;
      align-items: baseline;

      ::v-deep.static-unit {
        font-weight: 600;
        font-size: 14px;
        margin: 0 2px;
      }
    }
  }
}

.online-status {
  display: flex;
  justify-content: center;
  align-items: center;

  .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
  }

  .gray {
    background-color: #c5c5c5;
  }

  .orange {
    background-color: #fdb757;
  }

  .blue {
    background-color: #2a58ad;
  }
}
</style>