123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226 |
- <template>
- <div class="app-container">
- <div class="filter-container">
- <div class="filter-control">
- <span>设备名称:</span>
- <el-input
- v-model="listQuery.productName"
- placeholder="商品名称"
- style="width: 200px"
- class="filter-item"
- @keyup.enter.native="handleFilter"
- />
- </div>
- <div class="filter-control">
- <span>设备SN码:</span>
- <el-input
- v-model="listQuery.snCode"
- placeholder="商品SN码"
- style="width: 200px"
- class="filter-item"
- @keyup.enter.native="handleFilter"
- />
- </div>
- <div class="filter-control">
- <span>审核状态:</span>
- <el-select
- v-model="listQuery.auditStatus"
- placeholder="审核状态"
- clearable
- style="width: 200px"
- class="filter-item"
- @change="getList"
- >
- <el-option label="全部" value="" />
- <el-option label="待审核" :value="2" />
- <el-option label="审核通过" :value="1" />
- <el-option label="审核未通过" :value="0" />
- </el-select>
- </div>
- <div class="filter-control">
- <span>上线状态:</span>
- <el-select
- v-model="listQuery.status"
- placeholder="上线状态"
- clearable
- style="width: 200px"
- class="filter-item"
- @change="getList"
- >
- <el-option label="全部" value="" />
- <el-option label="已上线" :value="1" />
- <el-option label="待上线" :value="2" />
- <el-option label="未上线" :value="0" />
- </el-select>
- </div>
- <div class="filter-control">
- <el-button type="primary" @click="handleFilter">查询</el-button>
- </div>
- </div>
- <!-- 表格区域 -->
- <el-table
- :key="tableKey"
- v-loading="listLoading"
- :data="list"
- border
- fit
- highlight-current-row
- style="width: 100%"
- header-row-class-name="tableHeader"
- >
- <el-table-column label="序号" :index="indexMethod" type="index" align="center" width="80" />
- <el-table-column label="设备名称" align="center" prop="productName" />
- <el-table-column label="设备SN码" align="center" prop="snCode" />
- <el-table-column label="审核状态" width="120px" align="center">
- <template slot-scope="{ row }">
- <audit-status :status="row.auditStatus" :reason="row.invalidReason" />
- </template>
- </el-table-column>
- <el-table-column label="上线状态" width="120px" align="center">
- <template slot-scope="{ row }">
- <!-- 只有审核通过了才能操作上下线 auditStatus :审核状态 -->
- <template v-if="row.auditStatus === 1">
- <template v-if="row.status === 0">
- <span style="margin-right: 10px" class="status danger">已下线</span>
- <el-button
- v-if="userIdentity === 2 || proxyInfo !== null"
- type="primary"
- size="mini"
- @click="handleChangeStatus(row)"
- >上线</el-button>
- </template>
- <template v-else>
- <span style="margin-right: 10px" class="status success">已上线</span>
- <el-button
- v-if="userIdentity === 2 || proxyInfo !== null"
- type="info"
- size="mini"
- plain
- @click="handleChangeStatus(row)"
- >下线</el-button>
- </template>
- </template>
- <template v-else>
- <!-- <el-tag type="warning">待上线</el-tag> -->
- <span style="margin-right: 10px" class="status warning">待上线</span>
- </template>
- </template>
- </el-table-column>
- <el-table-column label="创建时间" class-name="status-col" width="160px" align="center">
- <template slot-scope="{ row }">
- <span>{{ row.createTime | formatTime }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" width="240px" class-name="small-padding fixed-width">
- <template slot-scope="{ row }">
- <el-button
- type="primary"
- size="mini"
- @click="navigationTo(`club-device-detail?productId=${row.productId}`)"
- >查看</el-button>
- <el-button type="primary" size="mini" :disabled="row.auditStatus !== 1" @click="handleShowQRcode(row)">
- 二维码
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <!-- 页码 -->
- <pagination :total="total" :page.sync="listQuery.pageNum" :limit.sync="listQuery.pageSize" @pagination="getList" />
- <!-- 二维码 -->
- <transition name="fade">
- <qrcode-device v-if="showQRcode" :product-info="productInfo" @close="showQRcode = false" />
- </transition>
- </div>
- </template>
- <script>
- import { getProdList } from '@/api/product'
- import QrcodeDevice from '@/components/QrcodeDevice'
- import { mapGetters } from 'vuex'
- export default {
- name: 'SupplierClubDeviceList',
- components: { QrcodeDevice },
- data() {
- return {
- tableKey: 0,
- list: null,
- total: 0,
- listLoading: true,
- listQuery: {
- status: '',
- auditStatus: '',
- authId: '',
- productName: '',
- snCode: '',
- pageNum: 1,
- pageSize: 10
- },
- showQRcode: false,
- productInfo: {}
- }
- },
- computed: {
- ...mapGetters(['userIdentity', 'proxyInfo'])
- },
- created() {
- this.listQuery.authId = this.$route.query.authId
- this.getList()
- },
- methods: {
- // 获取列表信息
- getList() {
- getProdList(this.listQuery)
- .then((res) => {
- const { total, list } = res.data
- this.total = total
- this.list = list
- // this.checkAuditFailedList(list)
- })
- .finally(() => {
- this.listLoading = false
- })
- },
- // 过滤列表
- handleFilter() {
- this.listQuery.page = 1
- this.getList()
- },
- // 显示二维码
- handleShowQRcode(item) {
- this.productInfo = item
- this.productInfo.authParty = item.authParty
- this.showQRcode = true
- },
- indexMethod(index) {
- return index + this.listQuery.pageSize * (this.listQuery.pageNum - 1) + 1
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .filter-container {
- span {
- display: inline-block;
- margin-bottom: 10px;
- vertical-align: middle;
- font-size: 14px;
- }
- .el-button {
- display: inline-block;
- margin-bottom: 10px;
- vertical-align: middle;
- }
- .el-input,
- .el-select {
- margin-right: 10px;
- margin-left: 10px;
- }
- }
- </style>
|