|
@@ -0,0 +1,101 @@
|
|
|
|
+<template>
|
|
|
|
+ <div class="app-container coupon-list">
|
|
|
|
+ <el-form v-show="showSearch" :model="queryParams" ref="queryForm" :inline="true" size="small">
|
|
|
|
+ <el-form-item label="商品名称" prop="title">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="queryParams.title"
|
|
|
|
+ placeholder="请输入商品名称"
|
|
|
|
+ clearable
|
|
|
|
+ @keyup.enter.native="queryParams.pageNum = 1;getList()"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="商品ID" prop="goodsId">
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="queryParams.goodsId"
|
|
|
|
+ placeholder="请输入商品名称"
|
|
|
|
+ clearable
|
|
|
|
+ @keyup.enter.native="queryParams.pageNum = 1;getList()"
|
|
|
|
+ />
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="上架状态" prop="status">
|
|
|
|
+ <el-select v-model="queryParams.status" placeholder="请选择商品状态" clearable>
|
|
|
|
+ <el-option label="上架" value="1" />
|
|
|
|
+ <el-option label="下架" value="2" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item>
|
|
|
|
+ <el-button type="primary" icon="el-icon-search" @click="queryParams.pageNum = 1;getList()">搜索</el-button>
|
|
|
|
+ <el-button icon="el-icon-refresh" @click="getList(true)">重置</el-button>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
|
+ <el-col :span="10">
|
|
|
|
+ <el-button v-hasPermi="['business:goods:add']" type="primary" icon="el-icon-plus" size="mini" @click="$router.push('/goods/add')">添加商品</el-button>
|
|
|
|
+ <el-button v-hasPermi="['business:goods:on']" type="primary" plain size="mini">上架</el-button>
|
|
|
|
+ <el-button v-hasPermi="['business:goods:off']" type="primary" plain size="mini">下架</el-button>
|
|
|
|
+ <el-button v-hasPermi="['business:goods:remove']" type="danger" plain size="mini">删除</el-button>
|
|
|
|
+ </el-col>
|
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
|
+ </el-row>
|
|
|
|
+ <el-table v-loading="loading" :data="tableData">
|
|
|
|
+ <el-table-column label="商品ID" prop="id" min-width="70" />
|
|
|
|
+ <el-table-column label="商品图片" prop="title" />
|
|
|
|
+ <el-table-column label="商品名称" prop="title" />
|
|
|
|
+ <el-table-column label="价格" prop="amount" />
|
|
|
|
+ <el-table-column label="兑换盲豆" prop="quiety" />
|
|
|
|
+ <el-table-column label="销量" prop="lastMessageTime" />
|
|
|
|
+ <el-table-column label="库存" prop="lastMessageTime" />
|
|
|
|
+ <el-table-column label="状态" prop="status">
|
|
|
|
+ <template slot-scope="{row}">
|
|
|
|
+ {{ JSON.parse(row.status).desc }}
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="排序" prop="lastMessageTime" />
|
|
|
|
+ <el-table-column fixed="right" align="right" label="操作" width="140">
|
|
|
|
+ <template slot-scope="{row}">
|
|
|
|
+ <el-button v-hasPermi="['business:goods:query']" type="text">查看</el-button>
|
|
|
|
+ <el-button v-hasPermi="['business:goods:edit']" type="text">编辑</el-button>
|
|
|
|
+ <el-button v-hasPermi="['business:goods:off']" type="text">下架</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList()" />
|
|
|
|
+ </div>
|
|
|
|
+</template>
|
|
|
|
+<script>
|
|
|
|
+import { getGoodsList } from '@/api/business/goods'
|
|
|
|
+export default {
|
|
|
|
+ name: 'GoodsList',
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ loading: false,
|
|
|
|
+ showSearch: true,
|
|
|
|
+ queryParams: {},
|
|
|
|
+ total: 0
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ created() {
|
|
|
|
+ this.getList(true)
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ getList(reset) {
|
|
|
|
+ if (this.loading) {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.loading = true
|
|
|
|
+ if (reset) {
|
|
|
|
+ this.queryParams = { pageNum: 1, pageSize: 20 }
|
|
|
|
+ }
|
|
|
|
+ getGoodsList('pageNum='+this.queryParams.pageNum + '&pageSize='+this.queryParams.pageSize+'&', this.queryParams).then(res => {
|
|
|
|
+ this.loading = false
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ this.tableData = res.rows
|
|
|
|
+ this.total = res.total
|
|
|
|
+ }
|
|
|
|
+ }).catch(() => {
|
|
|
|
+ this.loading = false
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</script>
|