| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <template>
- <div class="supply-manage-list">
- <el-card>
- <div slot="header">
- <span>供应商管理</span>
- <el-button style="float: right" type="primary" size="small" @click="$router.push('/supply-manage/create')">+ 新增供应商</el-button>
- </div>
- <el-form :inline="true" style="margin-bottom: 15px;">
- <el-form-item>
- <el-input v-model="searchKeyword" placeholder="搜索手机号/昵称/姓名" clearable @clear="loadData" @keyup.enter.native="loadData">
- <i slot="prefix" class="el-icon-search"></i>
- </el-input>
- </el-form-item>
- <el-form-item>
- <el-select v-model="searchVendorStatus" placeholder="服务商状态" clearable style="width: 150px" @change="loadData">
- <el-option label="待审核" value="pending"></el-option>
- <el-option label="已通过" value="approved"></el-option>
- <el-option label="已拒绝" value="rejected"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="loadData" :loading="loading">查询</el-button>
- </el-form-item>
- </el-form>
- <div style="overflow:auto;max-height:calc(100vh - 300px);">
- <el-table :data="suppliers" stripe v-loading="loading" style="max-height:calc(100vh - 300px);">
- <el-table-column prop="id" label="ID" width="70"></el-table-column>
- <el-table-column prop="nickname" label="昵称" width="130"></el-table-column>
- <el-table-column prop="realName" label="真实姓名" width="120"></el-table-column>
- <el-table-column prop="phone" label="手机号" width="130"></el-table-column>
- <el-table-column label="服务商类型" width="130">
- <template slot-scope="scope">
- <el-tag size="small">{{ getVendorTypeLabel(scope.row.vendorType) }}</el-tag>
- </template>
- </el-table-column>
- <el-table-column label="服务商状态" width="100">
- <template slot-scope="scope">
- <el-tag :type="getStatusType(scope.row.vendorStatus)" size="small">
- {{ getStatusLabel(scope.row.vendorStatus) }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column prop="createdAt" label="创建时间" width="170">
- <template slot-scope="scope">{{ scope.row.createdAt | parseTime('{y}-{m}-{d} {h}:{i}') }}</template>
- </el-table-column>
- <el-table-column label="操作" width="220" fixed="right">
- <template slot-scope="scope">
- <el-button size="mini" type="primary" @click="viewDetail(scope.row)">详情</el-button>
- <el-button size="mini" @click="$router.push('/supply-manage/' + scope.row.id + '/edit')">编辑</el-button>
- <el-button size="mini" type="danger" @click="handleDelete(scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <el-pagination
- v-if="total > 0"
- style="margin-top: 15px; text-align: right"
- background
- layout="total, prev, pager, next"
- :total="total"
- :page-size="pageSize"
- :current-page="page"
- @current-change="handlePageChange">
- </el-pagination>
- </el-card>
- </div>
- </template>
- <script>
- import { getSupplyManageList, deleteSupplyManage } from '@/api/admin'
- export default {
- name: 'SupplyManageList',
- data() {
- return {
- suppliers: [],
- loading: false,
- searchKeyword: '',
- searchVendorStatus: '',
- page: 1,
- pageSize: 10,
- total: 0
- }
- },
- created() {
- this.loadData()
- },
- methods: {
- async loadData() {
- this.loading = true
- try {
- const res = await getSupplyManageList({
- keyword: this.searchKeyword,
- vendorStatus: this.searchVendorStatus,
- page: this.page,
- size: this.pageSize
- })
- if (res.data) {
- this.suppliers = res.data.list || []
- this.total = res.data.total || 0
- }
- } catch (e) {
- this.$message.error('加载失败')
- } finally {
- this.loading = false
- }
- },
- handlePageChange(val) {
- this.page = val
- this.loadData()
- },
- async handleDelete(row) {
- try {
- await this.$confirm('确定要删除该供应商吗?', '提示', { type: 'warning' })
- await deleteSupplyManage({ id: row.id })
- this.$message.success('删除成功')
- this.loadData()
- } catch (e) {
- if (e !== 'cancel') {
- this.$message.error('删除失败')
- }
- }
- },
- viewDetail(row) {
- this.$router.push('/supply-manage/' + row.id)
- },
- getVendorTypeLabel(type) {
- const map = {
- planner: '成长规划师',
- activity_provider: '活动规划师',
- product_supplier: '商品供应商'
- }
- return map[type] || '-'
- },
- getStatusLabel(status) {
- const map = {
- pending: '待审核',
- approved: '已通过',
- rejected: '已拒绝',
- null: '-',
- '': '-'
- }
- return map[status] || status || '-'
- },
- getStatusType(status) {
- const map = {
- pending: 'warning',
- approved: 'success',
- rejected: 'danger'
- }
- return map[status] || 'info'
- }
- }
- }
- </script>
- <style scoped>
- .supply-manage-list {
- padding: 20px;
- }
- </style>
|