Files
temu-plugin/src/view/lables/Template.vue

152 lines
4.0 KiB
Vue
Raw Normal View History

<template>
<ai-list class="Template">
<ai-title
slot="title"
title="模板管理"
isShowBottomBorder>
</ai-title>
<template slot="content">
<ai-search-bar>
<template #left>
2024-10-28 18:30:26 +08:00
<div class="search-item">
<label>SKU</label>
<el-input
v-model="search.productSkuId"
style="width: 250px"
size="small"
clearable
placeholder="请输入SKU"
suffix-icon="iconfont iconSearch">
</el-input>
</div>
<div class="search-item">
<label>SKC</label>
<el-input
v-model="search.productSkcId"
style="width: 250px"
size="small"
placeholder="请输入SKC"
clearable
suffix-icon="iconfont iconSearch">
</el-input>
</div>
<div class="search-item">
<label>模板名称</label>
<el-input
v-model="search.name"
style="width: 250px"
size="small"
placeholder="请输入模板名称"
clearable
suffix-icon="iconfont iconSearch">
</el-input>
</div>
<el-button style="margin-left: 10px;" @click="getList" size="small" :loading="isLoading">查询</el-button>
2024-10-27 18:29:16 +08:00
<el-button type="primary" size="small" @click="toAdd('')">添加</el-button>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
:current.sync="search.current"
:size.sync="search.size"
style="margin-top: 8px;"
2024-10-28 18:30:26 +08:00
@getList="getList"
:loading="isLoading">
2024-10-18 13:37:05 +08:00
<el-table-column slot="options" label="操作" align="center" fixed="right" width="220px">
<template v-slot="{ row }">
<div class="table-options">
2024-10-28 18:30:26 +08:00
<el-button type="text" @click="toAddSku(row.id)">管理SKU</el-button>
2024-10-27 18:29:16 +08:00
<el-button type="text" @click="toAdd(row.id)">编辑</el-button>
2024-10-28 18:30:26 +08:00
<el-button type="text" @click="remove(row.id)">删除</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
export default {
name: 'PringTemplate',
data () {
return {
colConfigs: [
{ prop: 'name', label: '模板名称', align: 'left' },
2024-10-28 22:09:57 +08:00
{ prop: 'skuTotal', label: '绑定SKU数量', align: 'center' },
{ prop: 'createTime', label: '创建时间', align: 'center' },
],
2024-10-28 18:30:26 +08:00
isLoading: false,
2024-10-27 18:29:16 +08:00
tableData: [],
total: 0,
search: {
current: 1,
2024-10-28 18:30:26 +08:00
size: 10,
name: '',
productSkuId: '',
productSkcId: ''
2024-10-18 13:37:05 +08:00
}
}
},
created () {
2024-10-26 22:49:11 +08:00
this.getList()
},
methods: {
2024-10-27 18:29:16 +08:00
toAdd (id = '') {
this.$router.push(`/addLabelsTemplate?id=${id}`)
},
2024-10-27 18:29:16 +08:00
toAddSku (id) {
this.$router.push(`/skuManage?id=${id}`)
2024-10-18 13:37:05 +08:00
},
getList () {
2024-10-28 18:30:26 +08:00
this.isLoading = true
2024-10-26 22:49:11 +08:00
this.$http.post('/api/template/getPage', null, {
params: {
...this.search
}
}).then(res => {
if (res.code === 0) {
2024-10-26 22:49:11 +08:00
this.tableData = res.data.records
this.total = res.data.total
}
2024-10-28 18:30:26 +08:00
this.isLoading = false
})
},
remove (id) {
this.$confirm('确定删除该模板?', '温馨提示', {
type: 'warning'
}).then(() => {
this.$http.post(`/api/template/removeById?id=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('删除成功')
this.getList()
}
})
})
2024-10-18 13:37:05 +08:00
},
onConfirm () {
}
}
}
</script>
<style scoped lang="scss">
2024-10-28 18:30:26 +08:00
.Template {
.search-item {
margin-bottom: 0;
}
}
</style>