|
@@ -1,20 +1,33 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<el-row>
|
|
|
- <el-col :span="6">
|
|
|
+ <el-col :span="3">
|
|
|
+ <el-input v-model="search" placeholder="请输入商品名称"></el-input>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1">
|
|
|
+
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="3">
|
|
|
<el-select v-model="status">
|
|
|
<el-option value="-1" label="全部"></el-option>
|
|
|
<el-option value="1" label="在线"></el-option>
|
|
|
<el-option value="0" label="离线"></el-option>
|
|
|
</el-select>
|
|
|
</el-col>
|
|
|
+ <el-col :span="1">
|
|
|
+
|
|
|
+ </el-col>
|
|
|
<el-col :span="4">
|
|
|
<el-button type="primary" @click="getItems">查询</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-table :data="items">
|
|
|
<el-table-column label="商品ID" prop="gid"></el-table-column>
|
|
|
- <el-table-column label="商品图标" prop="icon">图标</el-table-column>
|
|
|
+ <el-table-column label="商品图标" width="110px">图标
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <img :src="scope.row.icon" style="width:100px;" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="商品名称" prop="name"></el-table-column>
|
|
|
<el-table-column label="简介" prop="describe"></el-table-column>
|
|
|
<el-table-column label="原价" prop="price.price"></el-table-column>
|
|
@@ -27,10 +40,18 @@
|
|
|
<el-table-column label="状态" prop="status" :formatter="statusFormater">
|
|
|
</el-table-column>
|
|
|
<el-table-column label="绑定套餐" prop="packageName"></el-table-column>
|
|
|
- <el-table-column label="操作">
|
|
|
+ <el-table-column label="操作" width="250px">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="text" size="small">预览</el-button>
|
|
|
- <el-button type="text" size="small">编辑</el-button>
|
|
|
+ <template v-if="scope.row.status == 0">
|
|
|
+ <el-button type="success" @click="setStatus(scope.row)">启用</el-button>
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <el-button type="warning" @click="setStatus(scope.row)">禁用</el-button>
|
|
|
+ </template>
|
|
|
+ <el-button type="text" size="small" @click="goEdit(scope.row)">编辑</el-button>
|
|
|
+ <a :href="serverPath + 'good/detail/' + scope.row.gid" target="_black">
|
|
|
+ <el-button type="text" size="small">预览</el-button>
|
|
|
+ </a>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -49,7 +70,10 @@ export default {
|
|
|
pageSize: 20,
|
|
|
items: [],
|
|
|
totalCount: 0,
|
|
|
- status: '-1'
|
|
|
+ status: '-1',
|
|
|
+ search:'',
|
|
|
+
|
|
|
+ serverPath:process.env.SERVER_PATH
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -59,7 +83,8 @@ export default {
|
|
|
{
|
|
|
page: this.page,
|
|
|
pageSize: this.pageSize,
|
|
|
- status: this.status
|
|
|
+ status: this.status,
|
|
|
+ search: this.search
|
|
|
},
|
|
|
this
|
|
|
)
|
|
@@ -73,12 +98,35 @@ export default {
|
|
|
this.getItems()
|
|
|
},
|
|
|
statusFormater: function(row) {
|
|
|
- console.log(row.status)
|
|
|
if (row.status === 1) {
|
|
|
return '在线'
|
|
|
} else {
|
|
|
return '离线'
|
|
|
}
|
|
|
+ },
|
|
|
+ setStatus: function(row){
|
|
|
+ let msg = row.status === 1? "禁用": "启用"
|
|
|
+
|
|
|
+ this.$confirm('您确定要将此商品设置为 "' + msg + '" , 是否继续?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.$http.setGoodStatus({gid: row.gid, status:(row.status === 1? false: true)}).then(res =>{
|
|
|
+ if (res.code === 0){
|
|
|
+ row.status = row.status === 1? 0: 1;
|
|
|
+ this.$message({
|
|
|
+ message: '操作成功',
|
|
|
+ type:'success'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+
|
|
|
+ });
|
|
|
+ },
|
|
|
+ goEdit: function (row){
|
|
|
+ this.$router.push({path:'/editGoods', query:{gid: row.gid}})
|
|
|
}
|
|
|
},
|
|
|
mounted: function() {
|