|
@@ -37,25 +37,33 @@
|
|
<el-button type="text" size="small" @click="goEditGoodsDescribe(scope.row)">编辑详细</el-button>
|
|
<el-button type="text" size="small" @click="goEditGoodsDescribe(scope.row)">编辑详细</el-button>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
- <el-table-column label="状态" prop="status" :formatter="statusFormater">
|
|
|
|
|
|
+ <el-table-column label="状态">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <template v-if="scope.row.status === 1">
|
|
|
|
+ <p class="online">启用</p>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <p class="offline">禁用</p>
|
|
|
|
+ </template>
|
|
|
|
+ </template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="绑定套餐" prop="packageName">
|
|
<el-table-column label="绑定套餐" prop="packageName">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<template v-if="scope.row.packageid === '0'">
|
|
<template v-if="scope.row.packageid === '0'">
|
|
- <el-button type="text" size="small" >去绑定</el-button>
|
|
|
|
|
|
+ <el-button type="text" size="small">去绑定</el-button>
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
- <el-button type="text" size="small" >{{scope.row.packageName}}</el-button>
|
|
|
|
|
|
+ <el-button type="text" size="small">{{scope.row.packageName}}</el-button>
|
|
</template>
|
|
</template>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
<el-table-column label="操作" width="250px">
|
|
<el-table-column label="操作" width="250px">
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
<template v-if="scope.row.status == 0">
|
|
<template v-if="scope.row.status == 0">
|
|
- <el-button type="success" @click="setStatus(scope.row)">启用</el-button>
|
|
|
|
|
|
+ <el-button type="success" @click="setStatus(scope.row)">启用</el-button>
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
- <el-button type="warning" @click="setStatus(scope.row)">禁用</el-button>
|
|
|
|
|
|
+ <el-button type="danger" @click="setStatus(scope.row)">禁用</el-button>
|
|
</template>
|
|
</template>
|
|
<el-button type="text" size="small" @click="goEdit(scope.row)">编辑</el-button>
|
|
<el-button type="text" size="small" @click="goEdit(scope.row)">编辑</el-button>
|
|
<a :href="serverPath + 'good/detail/' + scope.row.gid" target="_black">
|
|
<a :href="serverPath + 'good/detail/' + scope.row.gid" target="_black">
|
|
@@ -80,9 +88,9 @@ export default {
|
|
items: [],
|
|
items: [],
|
|
totalCount: 0,
|
|
totalCount: 0,
|
|
status: '-1',
|
|
status: '-1',
|
|
- search:'',
|
|
|
|
|
|
+ search: '',
|
|
|
|
|
|
- serverPath:process.env.SERVER_PATH
|
|
|
|
|
|
+ serverPath: process.env.SERVER_PATH
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -113,32 +121,41 @@ export default {
|
|
return '离线'
|
|
return '离线'
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- setStatus: function(row){
|
|
|
|
- let msg = row.status === 1? "禁用": "启用"
|
|
|
|
|
|
+ setStatus: function(row) {
|
|
|
|
+ let msg = row.status === 1 ? '禁用' : '启用'
|
|
|
|
|
|
- this.$confirm('您确定要将此商品设置为 "' + msg + '" , 是否继续?', '提示', {
|
|
|
|
|
|
+ this.$confirm(
|
|
|
|
+ '您确定要将此商品设置为 "' + msg + '" , 是否继续?',
|
|
|
|
+ '提示',
|
|
|
|
+ {
|
|
confirmButtonText: '确定',
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
type: 'warning'
|
|
- }).then(() => {
|
|
|
|
- this.$http.setGoodStatus({gid: row.gid, status:(row.status === 1? false: true)}, this).then(res =>{
|
|
|
|
- if (res.code === 0){
|
|
|
|
- row.status = row.status === 1? 0: 1;
|
|
|
|
- this.$message({
|
|
|
|
- message: '操作成功',
|
|
|
|
- type:'success'
|
|
|
|
- })
|
|
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ .then(() => {
|
|
|
|
+ this.$http
|
|
|
|
+ .setGoodStatus(
|
|
|
|
+ { gid: row.gid, status: row.status === 1 ? false : true },
|
|
|
|
+ this
|
|
|
|
+ )
|
|
|
|
+ .then(res => {
|
|
|
|
+ if (res.code === 0) {
|
|
|
|
+ row.status = row.status === 1 ? 0 : 1
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '操作成功',
|
|
|
|
+ type: 'success'
|
|
|
|
+ })
|
|
}
|
|
}
|
|
- })
|
|
|
|
- }).catch(() => {
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+ .catch(() => {})
|
|
},
|
|
},
|
|
- goEdit: function (row){
|
|
|
|
- this.$router.push({path:'/editGoods', query:{gid: row.gid}})
|
|
|
|
|
|
+ goEdit: function(row) {
|
|
|
|
+ this.$router.push({ path: '/editGoods', query: { gid: row.gid } })
|
|
},
|
|
},
|
|
- goEditGoodsDescribe: function(row){
|
|
|
|
- this.$router.push({path:'/editGoodsDescribe', query:{gid: row.gid}})
|
|
|
|
|
|
+ goEditGoodsDescribe: function(row) {
|
|
|
|
+ this.$router.push({ path: '/editGoodsDescribe', query: { gid: row.gid } })
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted: function() {
|
|
mounted: function() {
|
|
@@ -152,4 +169,10 @@ export default {
|
|
margin-top: 10px;
|
|
margin-top: 10px;
|
|
text-align: center;
|
|
text-align: center;
|
|
}
|
|
}
|
|
|
|
+.online {
|
|
|
|
+ color: #67c23a;
|
|
|
|
+}
|
|
|
|
+.offline {
|
|
|
|
+ color: #f56c6c;
|
|
|
|
+}
|
|
</style>
|
|
</style>
|