|
|
|
@ -30,14 +30,22 @@ |
|
|
|
|
<a-radio-button value="2">已下架</a-radio-button> |
|
|
|
|
</a-radio-group> |
|
|
|
|
</div> |
|
|
|
|
<a-button v-if="$auth('/goods/create')" class="fl-l" type="primary" icon="plus" @click="handleCreate()" |
|
|
|
|
>新增服务</a-button |
|
|
|
|
<a-button |
|
|
|
|
v-if="$auth('/goods/create')" |
|
|
|
|
class="fl-l" |
|
|
|
|
type="primary" |
|
|
|
|
icon="plus" |
|
|
|
|
@click="handleCreate()" |
|
|
|
|
>新增服务</a-button |
|
|
|
|
> |
|
|
|
|
<div v-if="selectedRowKeys.length" class="button-group"> |
|
|
|
|
<a-button-group class="ml-10"> |
|
|
|
|
<a-button v-action:status icon="arrow-up" @click="handleUpdateStatus(selectedRowKeys, true)">上架</a-button> |
|
|
|
|
<a-button v-action:status icon="arrow-down" @click="handleUpdateStatus(selectedRowKeys, false)" |
|
|
|
|
>下架</a-button |
|
|
|
|
<a-button |
|
|
|
|
v-action:status |
|
|
|
|
icon="arrow-down" |
|
|
|
|
@click="handleUpdateStatus(selectedRowKeys, false)" |
|
|
|
|
>下架</a-button |
|
|
|
|
> |
|
|
|
|
<a-button v-action:delete icon="delete" @click="handleDelete(selectedRowKeys)">删除</a-button> |
|
|
|
|
</a-button-group> |
|
|
|
@ -73,11 +81,11 @@ |
|
|
|
|
class="cur-p" |
|
|
|
|
:color="text == 1 ? 'green' : 'red'" |
|
|
|
|
@click="handleUpdateStatus([item.server_id], text != 1)" |
|
|
|
|
>{{ text == 1 ? '上架' : '下架' }}</a-tag |
|
|
|
|
>{{ text == 1 ? '上架' : '下架' }}</a-tag |
|
|
|
|
> |
|
|
|
|
</span> |
|
|
|
|
<!-- 操作项 --> |
|
|
|
|
<span class="actions" slot="action" slot-scope="item"> |
|
|
|
|
<span class="actions" slot="action" slot-scope="text, item"> |
|
|
|
|
<a style="margin-right: 8px" @click="handleEdit(item)">编辑</a> |
|
|
|
|
<a @click="handleDelete([item.server_id])">删除</a> |
|
|
|
|
</span> |
|
|
|
@ -96,53 +104,53 @@ import Edit from './modules/Edit' |
|
|
|
|
const columns = [ |
|
|
|
|
{ |
|
|
|
|
title: '服务ID', |
|
|
|
|
dataIndex: 'server_id', |
|
|
|
|
dataIndex: 'server_id' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: '服务图片', |
|
|
|
|
dataIndex: 'server_image', |
|
|
|
|
scopedSlots: { customRender: 'server_image' }, |
|
|
|
|
scopedSlots: { customRender: 'server_image' } |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: '服务名称', |
|
|
|
|
dataIndex: 'server_name', |
|
|
|
|
scopedSlots: { customRender: 'server_name' }, |
|
|
|
|
scopedSlots: { customRender: 'server_name' } |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: '服务分类', |
|
|
|
|
dataIndex: 'server_category', |
|
|
|
|
scopedSlots: { customRender: 'server_category' }, |
|
|
|
|
scopedSlots: { customRender: 'server_category' } |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: '服务价格', |
|
|
|
|
dataIndex: 'server_price', |
|
|
|
|
scopedSlots: { customRender: 'server_price' }, |
|
|
|
|
scopedSlots: { customRender: 'server_price' } |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: '划线价格', |
|
|
|
|
dataIndex: 'line_price', |
|
|
|
|
scopedSlots: { customRender: 'line_price' }, |
|
|
|
|
scopedSlots: { customRender: 'line_price' } |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: '状态', |
|
|
|
|
dataIndex: 'status', |
|
|
|
|
scopedSlots: { customRender: 'status' }, |
|
|
|
|
scopedSlots: { customRender: 'status' } |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: '排序', |
|
|
|
|
dataIndex: 'sort', |
|
|
|
|
dataIndex: 'sort' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: '添加时间', |
|
|
|
|
width: '180px', |
|
|
|
|
dataIndex: 'create_time', |
|
|
|
|
dataIndex: 'create_time' |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
title: '操作', |
|
|
|
|
dataIndex: 'action', |
|
|
|
|
width: '150px', |
|
|
|
|
scopedSlots: { customRender: 'action' }, |
|
|
|
|
}, |
|
|
|
|
scopedSlots: { customRender: 'action' } |
|
|
|
|
} |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
@ -151,9 +159,9 @@ export default { |
|
|
|
|
ContentHeader, |
|
|
|
|
STable, |
|
|
|
|
Add, |
|
|
|
|
Edit, |
|
|
|
|
Edit |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
|
// 当前表单元素 |
|
|
|
|
searchForm: this.$form.createForm(this), |
|
|
|
@ -177,10 +185,10 @@ export default { |
|
|
|
|
return Api.serverList({ ...param, ...this.queryParam }).then((response) => { |
|
|
|
|
return response.data.list |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
created() { |
|
|
|
|
created () { |
|
|
|
|
// 默认的查询参数 |
|
|
|
|
if (this.$route.query.status) { |
|
|
|
|
this.queryParam.status = this.$route.query.status |
|
|
|
@ -189,37 +197,37 @@ export default { |
|
|
|
|
this.getCategoryList() |
|
|
|
|
}, |
|
|
|
|
computed: { |
|
|
|
|
rowSelection() { |
|
|
|
|
rowSelection () { |
|
|
|
|
return { |
|
|
|
|
selectedRowKeys: this.selectedRowKeys, |
|
|
|
|
onChange: this.onSelectChange, |
|
|
|
|
onChange: this.onSelectChange |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 选中项发生变化时的回调 |
|
|
|
|
onSelectChange(selectedRowKeys) { |
|
|
|
|
onSelectChange (selectedRowKeys) { |
|
|
|
|
this.selectedRowKeys = selectedRowKeys |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 切换tab |
|
|
|
|
handleTabs(e) { |
|
|
|
|
handleTabs (e) { |
|
|
|
|
this.queryParam.status = e.target.value |
|
|
|
|
this.handleRefresh(true) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 确认搜索 |
|
|
|
|
handleSearch(e) { |
|
|
|
|
handleSearch (e) { |
|
|
|
|
this.handleRefresh(true) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 重置搜索表单 |
|
|
|
|
handleReset() { |
|
|
|
|
handleReset () { |
|
|
|
|
this.searchForm.resetFields() |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 获取分类列表 |
|
|
|
|
getCategoryList() { |
|
|
|
|
getCategoryList () { |
|
|
|
|
this.isLoading = true |
|
|
|
|
Api.categoryList() |
|
|
|
|
.then((result) => { |
|
|
|
@ -229,7 +237,7 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 修改服务状态(上下架) |
|
|
|
|
handleUpdateStatus(serverIds, state = true) { |
|
|
|
|
handleUpdateStatus (serverIds, state = true) { |
|
|
|
|
this.isLoading = true |
|
|
|
|
Api.serverStatus({ serverIds, state }) |
|
|
|
|
.then((result) => { |
|
|
|
@ -243,28 +251,28 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 删除记录 |
|
|
|
|
handleDelete(serverId) { |
|
|
|
|
handleDelete (serverId) { |
|
|
|
|
const app = this |
|
|
|
|
const modal = this.$confirm({ |
|
|
|
|
title: '您确定要删除该记录吗?', |
|
|
|
|
content: '删除后不可恢复', |
|
|
|
|
onOk() { |
|
|
|
|
onOk () { |
|
|
|
|
return Api.deleteServer({ serverId }) |
|
|
|
|
.then((result) => { |
|
|
|
|
app.$message.success(result.message, 1.5) |
|
|
|
|
app.handleRefresh() |
|
|
|
|
}) |
|
|
|
|
.finally((result) => modal.destroy()) |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 新增记录 |
|
|
|
|
handleCreate() { |
|
|
|
|
handleCreate () { |
|
|
|
|
this.$refs.AddRef.add() |
|
|
|
|
}, |
|
|
|
|
// 编辑记录 |
|
|
|
|
async handleEdit(record) { |
|
|
|
|
async handleEdit (record) { |
|
|
|
|
// 显示对话框 |
|
|
|
|
this.$refs.EditRef.edit(record) |
|
|
|
|
}, |
|
|
|
@ -272,11 +280,11 @@ export default { |
|
|
|
|
* 刷新列表 |
|
|
|
|
* @param Boolean bool 强制刷新到第一页 |
|
|
|
|
*/ |
|
|
|
|
handleRefresh(bool = false) { |
|
|
|
|
handleRefresh (bool = false) { |
|
|
|
|
this.selectedRowKeys = [] |
|
|
|
|
this.$refs.table.refresh(bool) |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
<style lang="less" scoped> |
|
|
|
|