ShopsList.vue 6.4 KB
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="商铺名称">
              <j-input placeholder="请输入商铺名称" v-model="queryParam.propertyName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :md="8" :sm="10">
            <a-form-item label="入驻时间">
              <a-range-picker @change="onChange" />
            </a-form-item>
          </a-col>
          <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
            <a-col :md="6" :sm="24">
              <a-button type="primary" @click="searchQuery">查询</a-button>
              <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
            </a-col>
          </span>
        </a-row>
      </a-form>
    </div>
    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="propertyDetails(1)" type="primary" icon="plus">绑定商铺</a-button>
    </div>
    <!-- table区域-begin -->
    <div>
      <a-table ref="table" size="middle" :scroll="{x:true}" bordered rowKey="id" :columns="columns"
        :dataSource="dataSource" :pagination="pagination" :loading="loading" class="j-table-force-nowrap"
        @change="handleTableChange">
        <span slot="propertyStatus" slot-scope="text, record">
          <a-tag color="green" v-if="record.propertyStatus === 'normal'">正常</a-tag>
          <a-tag color="red" v-else>冻结</a-tag>
        </span>
        <span slot="action" slot-scope="text, record">
          <a href="javascript:;" @click="propertyDetails(4, record.id)">详情</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">
              更多 <a-icon type="down" />
            </a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a href="javascript:;"
                  @click="onStatus(1,record)">{{record.propertyStatus === 'normal' ? '冻结' : '解冻'}}</a>
              </a-menu-item>
              <a-menu-item>
                <a href="javascript:;" @click="propertyDetails(2, record.id)">修改</a>
              </a-menu-item>
              <a-menu-item>
                <a href="javascript:;" @click="propertyDetails(3, record.id)">审核</a>
              </a-menu-item>
              <a-menu-item>
                <a href="javascript:;" @click="onStatus(2,record)">解绑</a>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
  </a-card>
</template>

<script>
//import { auditPropertyApi, freezeOrPropertyApi } from '@/api/api'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { filterDictTextByCache } from '@/components/dict/JDictSelectUtil'

const columns = [
  {
    title: '商铺名称',
    dataIndex: 'propertyName',
    key: 'propertyName',
    align: 'center',
  },
  {
    title: '统一社会信用代码',
    dataIndex: 'creditCode',
    key: 'creditCode',
    align: 'center',
  },
  {
    title: '联系人',
    dataIndex: 'contactName',
    key: 'contactName',
    align: 'center',
  },
  {
    title: '电话',
    dataIndex: 'contactPhone',
    key: 'contactPhone',
    align: 'center',
  },
  {
    title: '分利',
    dataIndex: 'registCapital',
    key: 'registCapital',
    align: 'center',
  },
  {
    title: '交易金额',
    dataIndex: 'empowerCommunityNum',
    key: 'empowerCommunityNum',
    align: 'center',
  },
  {
    title: '审核状态',
    dataIndex: 'auditStatus',
    key: 'auditStatus',
    customRender: function (text) {
      return filterDictTextByCache('auditStatus', text)
    },
  },
  {
    title: '冻结/解冻',
    dataIndex: 'propertyStatus',
    scopedSlots: { customRender: 'propertyStatus' },
    key: 'propertyStatus',
    align: 'center',
  },
  {
    title: '操作',
    dataIndex: 'action',
    scopedSlots: { customRender: 'action' },
    align: 'center',
    fixed: 'right',
    width: 150,
  },
]

export default {
  name: 'ShopsList',
  mixins: [JeecgListMixin],
  components: {},
  data() {
    return {
      columns: columns,
      loading: false,
      pagination: {
        total: 0,
        current: 1,
        pageSize: 10,
        showSizeChanger: true,
      },
      url: {
        list: '/property-central/property/propertySettled/list',
      },
    }
  },
  methods: {
    propertyDetails(type, id) {
      if (type == 1) {
        this.$router.push({
          path: '/shops/shopsDetails?type=add',
        })
      } else if (type == 2) {
        this.$router.push({
          path: '/shops/shopsDetails?type=edit&id=' + id,
        })
      } else if (type == 3) {
        this.$router.push({
          path: '/shops/shopsDetails?type=audit&id=' + id,
        })
      } else if (type == 4) {
        this.$router.push({
          path: '/shops/shopsDetails?type=detail&id=' + id,
        })
      }
    },
    onChange(date, dateString) {
      if (dateString.length > 0) {
        this.queryParam.createTime_begin = dateString[0]
        this.queryParam.createTime_end = dateString[1]
      } else {
        this.queryParam.createTime_begin = ''
        this.queryParam.createTime_end = ''
      }
    },
    onStatus(type, record) {
      let that = this
      if (type == 1) {
        this.$confirm({
          title: `确认${record.propertyStatus === 'normal' ? '冻结' : '解冻'}此商铺?`,
          closable: true,
          okText: `${record.propertyStatus === 'normal' ? '冻结' : '解冻'}`,
          onOk() {
            // return freezeOrPropertyApi({
            //   id: record.id,
            //   status: `${record.propertyStatus === 'normal' ? 'freeze' : 'normal'}`,
            // }).then((res) => {
            //   that.searchQuery()
            // })
          },
          onCancel() {},
        })
      } else if (type == 2) {
        this.$confirm({
          title: `确认解绑商铺?`,
          closable: true,
          okText: `解绑`,
          onOk() {
            // return freezeOrPropertyApi({
            //   id: record.id,
            //   status: `${record.propertyStatus === 'normal' ? 'freeze' : 'normal'}`,
            // }).then((res) => {
            //   that.searchQuery()
            // })
          },
          onCancel() {},
        })
      }
    },
  },
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>