mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-11-11 03:18:56 +08:00
- 新增平台、商家定时上架独立页面,平台列表仅供查看 - 虚拟销量支持状态筛选及右侧抽屉设置,修复编码显示问题 - 统一列表操作栏,优化商品选择器、砍价、积分及优惠券页面 - 两端新增活动优惠券入口,隐藏创建表单中的活动类型字段 - 移除限时直降、第 N 件优惠页面、路由、接口调用及缓存菜单入口 验证:26 个改动前端文件编译或语法检查通过,暂存差异格式检查通过。
137 lines
4.4 KiB
Vue
137 lines
4.4 KiB
Vue
<template>
|
|
<div class="search">
|
|
<el-card class="parameter-filter-card">
|
|
<el-form ref="searchFormRef" :model="searchForm" inline class="search-form" @keyup.enter="handleSearch">
|
|
<el-form-item label="参数名称" prop="paramName">
|
|
<el-input
|
|
v-model="searchForm.paramName"
|
|
type="text"
|
|
placeholder="请输入参数名称"
|
|
clearable
|
|
style="width: 200px"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button type="primary" icon="search" @click="handleSearch">搜索</el-button>
|
|
<el-button @click="handleReset">重置</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-card>
|
|
|
|
<el-card class="parameter-list-card" style="margin-top: 10px">
|
|
<list-action-bar>
|
|
<el-button type="primary" @click="goAdd">添加</el-button>
|
|
</list-action-bar>
|
|
<el-table
|
|
ref="tableRef"
|
|
v-loading="loading"
|
|
:data="data"
|
|
border
|
|
style="width: 100%"
|
|
>
|
|
<el-table-column prop="paramName" label="参数名称" min-width="140">
|
|
<template #default="{ row }">
|
|
<span v-if="row">{{ row.paramName }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="paramType" label="类型" width="120">
|
|
<template #default="{ row }">
|
|
<span v-if="row">{{ row.paramType === 1 ? '文本' : '单选' }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="options" label="参数值" min-width="160">
|
|
<template #default="{ row }">
|
|
<span v-if="row">{{ row.options }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="isIndex" label="是否检索" width="100">
|
|
<template #default="{ row }">
|
|
<span v-if="row">{{ isTruthyFlag(row.isIndex) ? "是" : "否" }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="操作" width="300" align="center" fixed="right">
|
|
<template #default="{ row }">
|
|
<div v-if="row">
|
|
<a class="link-text" @click="goEdit(row)">编辑</a>
|
|
<span class="op-split">|</span>
|
|
<a class="link-text" @click="remove(row)">删除</a>
|
|
</div>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<div class="mt_10" style="display: flex; justify-content: flex-end">
|
|
<el-pagination
|
|
v-model:current-page="searchForm.pageNumber"
|
|
v-model:page-size="searchForm.pageSize"
|
|
:page-sizes="[20, 50, 100]"
|
|
:total="total"
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
size="small"
|
|
@current-change="getDataList"
|
|
@size-change="() => { searchForm.pageNumber = 1; getDataList(); }"
|
|
/>
|
|
</div>
|
|
</el-card>
|
|
</div>
|
|
</template>
|
|
<script setup>
|
|
import ListActionBar from "@/components/list-action-bar.vue";
|
|
import { ref } from "vue";
|
|
import { useTable } from "@/utils/useTable";
|
|
import { useRouter } from "vue-router";
|
|
import { deleteParams, getGoodsParamsPage } from "@/api/goods";
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
|
defineOptions({ name: "categoryParams" });
|
|
|
|
const router = useRouter();
|
|
const searchFormRef = ref(null);
|
|
const tableRef = ref(null);
|
|
|
|
const { loading, data, total, searchForm, getDataList, handleSearch, resetSearch } = useTable(
|
|
getGoodsParamsPage,
|
|
{
|
|
pageSize: 20,
|
|
form: { sort: "createTime", order: "desc", paramName: "" },
|
|
}
|
|
);
|
|
|
|
function isTruthyFlag(val) {
|
|
return val === 1 || val === "1" || val === true;
|
|
}
|
|
|
|
function handleReset() {
|
|
resetSearch();
|
|
}
|
|
|
|
function goAdd() {
|
|
router.push({ name: "goods-parameter-edit" });
|
|
}
|
|
|
|
function goEdit(row) {
|
|
if (!row || !row.id) return;
|
|
try {
|
|
window.sessionStorage.setItem(`goods-parameter-edit:${row.id}`, JSON.stringify(row));
|
|
} catch (e) {}
|
|
router.push({ name: "goods-parameter-edit", query: { id: row.id } });
|
|
}
|
|
|
|
function remove(row) {
|
|
ElMessageBox.confirm("您确认要删除 " + (row.paramName || "") + " ?", "确认删除", { type: "warning" }).then(() => {
|
|
return deleteParams(row.id).then((res) => {
|
|
if (res && res.success) {
|
|
ElMessage.success("删除成功");
|
|
getDataList();
|
|
}
|
|
});
|
|
}).catch(() => {});
|
|
}
|
|
</script>
|
|
<style lang="scss">
|
|
.link-text {
|
|
color: #409eff;
|
|
cursor: pointer;
|
|
text-decoration: none;
|
|
}
|
|
</style>
|