feat: 商品上架优化

This commit is contained in:
duan
2025-03-06 10:09:55 +08:00
parent 8838df65fb
commit a8a8a58cad
4 changed files with 14 additions and 5 deletions

View File

@@ -3,8 +3,8 @@
<el-form :inline="true" :model="formInline" class="demo-form-inline"> <el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="耗材分类"> <el-form-item label="耗材分类">
<el-select v-model="formInline.region" placeholder="请选择耗材分类" clearable> <el-select v-model="formInline.region" placeholder="请选择耗材分类" clearable>
<el-option label="Zone one" value="shanghai" /> <el-option label="Zonesne" value="shanghai" />
<el-option label="Zone two" value="beijing" /> <el-option label="Zonestwo" value="beijing" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="耗材名称"> <el-form-item label="耗材名称">

View File

@@ -10,7 +10,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" prop="status"> <el-table-column prop="status" align="center" label="状态">
<template #default="scope"> <template #default="scope">
<el-tag :type="scope.row.status === 1 ? 'success' : 'danger'">{{ scope.row.status === 1 ? '上架' : '下架' <el-tag :type="scope.row.status === 1 ? 'success' : 'danger'">{{ scope.row.status === 1 ? '上架' : '下架'
}}</el-tag> }}</el-tag>

View File

@@ -22,6 +22,10 @@
<template #gender="scope"> <template #gender="scope">
<DictLabel v-model="scope.row[scope.prop]" code="gender" /> <DictLabel v-model="scope.row[scope.prop]" code="gender" />
</template> </template>
<template #switchs="scope">
<el-switch v-model="scope.row[scope.prop]" :active-value="1" :inactive-value="0" active-text="启用"
inactive-text="禁用" @change="handleSwitchChange"></el-switch>
</template>
<template #mobile="scope"> <template #mobile="scope">
<el-text>{{ scope.row[scope.prop] }}</el-text> <el-text>{{ scope.row[scope.prop] }}</el-text>
<copy-button v-if="scope.row[scope.prop]" :text="scope.row[scope.prop]" style="margin-left: 2px" /> <copy-button v-if="scope.row[scope.prop]" :text="scope.row[scope.prop]" style="margin-left: 2px" />
@@ -103,6 +107,11 @@ async function handleAddClick() {
// 加载角色下拉数据源 // 加载角色下拉数据源
// addModalConfig.formItems[4]!.options = await RoleAPI.getOptions(); // addModalConfig.formItems[4]!.options = await RoleAPI.getOptions();
} }
// 上架
function handleSwitchChange(val: boolean, row: IObject) {
console.log(val, row);
// UserAPI.updateById({ id: row.id, isSale: val ? 1 : 0 });
}
// 编辑 // 编辑
async function handleEditClick(row: IObject) { async function handleEditClick(row: IObject) {
router.push({ name: 'addgoods', query: { goods_id: row.id } }); router.push({ name: 'addgoods', query: { goods_id: row.id } });

View File

@@ -43,7 +43,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
id: data.id, id: data.id,
isSale: data.value isSale: data.value
} }
// return UserAPI.onOff(obj); return UserAPI.onOff(obj);
}, },
deleteAction: UserAPI.deleteByIds, deleteAction: UserAPI.deleteByIds,
importsAction(data) { importsAction(data) {
@@ -82,7 +82,7 @@ const contentConfig: IContentConfig<UserPageQuery> = {
{ {
label: "上架", label: "上架",
align: "center", align: "center",
prop: "isSale", prop: "status",
templet: "switch", templet: "switch",
slotName: "status", slotName: "status",
}, },