refactor(page-decoration): 重构移动端页面管理界面,使用Tabs组件替换分类卡片

feat(wap): 为移动端页面列表添加类型标签页功能
fix(dialog): 修复对话框确认后未隐藏的问题
style: 统一移动端页面管理样式,优化表格布局
This commit is contained in:
pikachu1995@126.com
2025-12-07 13:48:19 +08:00
parent 028f32a73c
commit d701c72928
6 changed files with 98 additions and 256 deletions

View File

@@ -309,11 +309,12 @@ export default {
},
// 上架
upper(v) {
DialogPlugin.confirm({
const dlg = DialogPlugin.confirm({
header: "确认上架",
content: "您确认要上架 " + v.goodsName + " ?",
theme: "warning",
onConfirm: () => {
dlg.hide();
const params = { goodsId: v.id };
upGoods(params).then((res) => {
if (res.success) {
@@ -364,11 +365,12 @@ export default {
this.goodsAuditForm.authFlag = "REFUSE";
}
DialogPlugin.confirm({
const dlg = DialogPlugin.confirm({
header: "确认审核",
content: "您确认要审核" + examine + " " + v.goodsName + " ?",
theme: "warning",
onConfirm: () => {
dlg.hide();
this.goodsAuditForm.goodsIds = v.id;
const formData = new FormData();
formData.append('goodsIds', v.id);
@@ -395,11 +397,12 @@ export default {
// 确认审核(二次确认)
confirmAudit() {
const auditText = this.goodsAuditForm.auth_flag === 1 ? '通过' : '拒绝';
DialogPlugin.confirm({
const dlg = DialogPlugin.confirm({
header: '确认审核',
content: `您确认要审核${auditText} "${this.currentAuditGoods.goodsName}" 吗?`,
theme: 'warning',
onConfirm: () => {
dlg.hide();
this.submitAudit();
},
});
@@ -515,11 +518,12 @@ export default {
const actionText = this.batchAuditForm.auth_flag === 1 ? '通过' : '拒绝';
const goodsNames = this.selectedRows.map(item => item.goodsName).join('、');
DialogPlugin.confirm({
const dlg = DialogPlugin.confirm({
header: `确认批量审核${actionText}`,
content: `您确认要${actionText}以下商品的审核吗?\n${goodsNames}`,
theme: 'warning',
onConfirm: () => {
dlg.hide();
const goodsIds = this.selectedRows.map(item => item.id);
const formData = new FormData();
formData.append('goodsId', goodsIds);

View File

@@ -1,62 +1,40 @@
<template>
<div class="wrapper">
<t-card class="category">
<div
:class="{ active: i == selectedIndex }"
class="category-item"
v-for="(typeItem, i) in pageTypes"
:key="typeItem.type"
>
<div @click="clickType(typeItem.type, i)">{{ typeItem.title }}</div>
</div>
</t-card>
<t-card class="content">
<t-button theme="primary" @click="createTemp">添加页面</t-button>
<div class="list">
<t-loading v-if="loading" fullscreen></t-loading>
<div class="item item-title">
<div>页面名称</div>
<div class="item-config">
<div>
<div v-if="searchForm.pageType !== 'SPECIAL'">状态</div>
</div>
<div>操作</div>
</div>
</div>
<t-tabs :value="searchForm.pageType" @change="onTabsChange" class="wap-tabs">
<t-tab-panel value="INDEX" label="首页" />
<t-tab-panel value="SPECIAL" label="专题" />
</t-tabs>
<div class="item" v-for="(item, index) in list" :key="index">
<div>{{ item.name || "暂无模板昵称" }}</div>
<div class="item-config">
<div>
<t-switch
v-if="searchForm.pageType !== 'SPECIAL'"
v-model="item.pageShow"
@change="releaseTemplate(item.id)"
>
<span slot="open"></span>
<span slot="close"></span>
</t-switch>
</div>
<div class="action">
<t-button theme="default" @click="Template(item)" size="small">编辑</t-button>
<t-button theme="success" @click="decorate(item)" size="small">装修</t-button>
<t-button theme="danger" size="small" @click="confirmDelTemplate(item.id)">删除</t-button>
</div>
</div>
</div>
<div class="no-more" v-if="list.length == 0">暂无更多模板</div>
</div>
<div class="operation padding-row">
<t-button theme="primary" @click="createTemp">添加页面</t-button>
</div>
<t-table :loading="loading" :columns="columns" :data="list" rowKey="id" class="mt_10">
<template #statusSlot="{ row }">
<t-switch v-if="searchForm.pageType !== 'SPECIAL'" v-model="row.pageShow" @change="releaseTemplate(row.id)"></t-switch>
</template>
<template #action="{ row }">
<a style="color:#2d8cf0;cursor:pointer;text-decoration:none" @click="Template(row)">编辑</a>
<span style="margin:0 8px;color:#dcdee2">|</span>
<a style="color:#2d8cf0;cursor:pointer;text-decoration:none" @click="decorate(row)">装修</a>
<span style="margin:0 8px;color:#dcdee2">|</span>
<t-popconfirm content="删除此模板?" @confirm="confirmDelTemplate(row.id)">
<a style="color:#2d8cf0;cursor:pointer;text-decoration:none">删除</a>
</t-popconfirm>
</template>
</t-table>
<div class="mt_10" style="display: flex; justify-content: flex-end">
<t-pagination
:total="total"
size="small"
:pageSizeOptions="[20, 50, 100]"
showJumper
style="float: right; overflow: hidden"
:pageSize="searchForm.pageSize"
@change="({ current }) => changePageNum(current)"
@page-size-change="(size) => changePageSize(size)"
/>
</t-card>
</div>
<t-dialog
:visible.sync="showModal"
header="模板设置"
@@ -98,18 +76,9 @@ export default {
pageClientType: "PC",
},
columns: [
// 列表展示的column
{
title: "页面名称",
key: "name",
},
{
title: "状态",
},
{
title: "操作",
key: "action",
},
{ title: "页面名称", colKey: "name", width: 260 },
{ title: "状态", colKey: "statusSlot", width: 120 },
{ title: "操作", colKey: "action", align: "center", fixed: "right", width: 200 },
],
loading: false, // 加载状态
@@ -131,6 +100,11 @@ export default {
this.getTemplateList();
},
methods: {
onTabsChange(val) {
this.searchForm.pageNumber = 1;
this.searchForm.pageType = val;
this.getTemplateList();
},
newTemplate() {
// 添加,编辑模板
this.$refs.form.validate((valid) => {
@@ -258,68 +232,12 @@ export default {
</script>
<style lang="scss" scoped>
.category-item {
cursor: pointer;
padding: 4px;
}
.active {
background: #ededed;
}
.item-title {
background: #d7e7f5 !important;
height: 54px;
}
.no-more {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.wap-tabs { margin-bottom: 12px; }
.wrapper {
background: #fff;
padding: 20px;
display: flex;
flex-direction: column;
}
.category {
flex: 2;
}
.content {
flex: 8;
}
* {
margin: 5px;
}
.list {
min-height: 600px;
position: relative;
}
.item:nth-of-type(2) {
margin: 0 5px;
}
.item {
width: 100% !important;
padding: 0 4px;
display: flex;
align-items: center;
justify-content: space-between;
> .item-config {
width: 250px;
display: flex;
justify-content: space-between;
align-items: center;
div:nth-child(2) {
margin-right: 80px;
}
}
}
.item:nth-of-type(2n + 1) {
background: #f5f7fa;
}
.action{
display: flex;
align-items: center;
width: 100px;
}
.mt_10 { margin-top: 10px; }
</style>

View File

@@ -1,50 +1,27 @@
<template>
<div class="wrapper">
<t-card class="category">
<div
:class="{ active: i == selectedIndex }"
class="category-item"
v-for="(typeItem, i) in pageTypes"
:key="typeItem.type"
>
<div @click="clickType(typeItem.type, i)">{{ typeItem.title }}</div>
</div>
</t-card>
<t-card class="content">
<t-button theme="primary" @click="handleAdd()">添加页面</t-button>
<div class="list">
<t-loading size="large" v-if="loading"></t-loading>
<div class="item item-title">
<div>页面名称</div>
<div class="item-config">
<div>状态</div>
<div>操作</div>
</div>
</div>
<div class="item" v-for="(item, index) in list" :key="index">
<div>{{ item.name || "暂无模板昵称" }}</div>
<div class="item-config">
<t-switch v-model="item.pageShow" @change="changeSwitch(item)"></t-switch>
<t-button theme="primary" variant="outline" @click="handleEdit(item)" size="small">修改</t-button>
<t-popconfirm content="删除此模板?" @confirm="handleDel(item)">
<t-button theme="danger" size="small">删除</t-button>
</t-popconfirm>
</div>
</div>
<div class="no-more" v-if="list.length ==0">暂无更多模板</div>
</div>
<t-pagination
:total="total"
:current="params.pageNumber"
:pageSize="params.pageSize"
:pageSizeOptions="[20, 50, 100]"
size="small"
showJumper
showPageSize
@change="onPaginationChange"
/>
</t-card>
<t-tabs :value="params.pageType" @change="onTabsChange" class="wap-tabs">
<t-tab-panel value="INDEX" label="首页" />
<t-tab-panel value="SPECIAL" label="专题" />
</t-tabs>
<div class="operation padding-row">
<t-button theme="primary" @click="handleAdd">添加页面</t-button>
</div>
<t-table :loading="loading" :columns="columns" :data="list" rowKey="id" class="mt_10">
<template #statusSlot="{ row }">
<t-switch v-model="row.pageShow" @change="changeSwitch(row)"></t-switch>
</template>
<template #action="{ row }">
<a style="color:#2d8cf0;cursor:pointer;text-decoration:none" @click="handleEdit(row)">修改</a>
<span style="margin:0 8px;color:#dcdee2">|</span>
<t-popconfirm content="删除此模板?" @confirm="handleDel(row)">
<a style="color:#2d8cf0;cursor:pointer;text-decoration:none">删除</a>
</t-popconfirm>
</template>
</t-table>
<div class="mt_10" style="display: flex; justify-content: flex-end;">
<t-pagination :current="params.pageNumber" :total="Number(total)" :pageSize="params.pageSize" :pageSizeOptions="[20, 50, 100]" size="small" :showJumper="true" @change="onPaginationChange" />
</div>
</div>
</template>
<script>
@@ -55,18 +32,9 @@ export default {
return {
selectedIndex: 0, // 装修那个页面的下标
columns: [
// 表头
{
title: "页面名称",
key: "name"
},
{
title: "状态"
},
{
title: "操作",
key: "action"
}
{ title: "页面名称", colKey: "name", width: 260 },
{ title: "状态", colKey: "statusSlot", width: 120 },
{ title: "操作", colKey: "action", align: "center", fixed: "right", width: 180 }
],
loading: false, // 加载状态
@@ -115,26 +83,10 @@ export default {
this.init();
},
methods: {
// 切换tab
clickType(val, index) {
if (val == "ALERT") {
this.$router.push({
path: "/floorList/main",
query: { pagetype: val },
});
return;
} else if (val == "OPEN_SCREEN_ANIMATION") {
this.$router.push({
path: "/floorList/main",
query: { pagetype: val },
});
return;
} else {
this.params.pageNumber = 1;
this.selectedIndex = index;
this.params.pageType = val;
this.init();
}
onTabsChange(val) {
this.params.pageNumber = 1;
this.params.pageType = val;
this.init();
},
// 分页 修改页码
@@ -223,59 +175,15 @@ export default {
};
</script>
<style scoped lang="scss">
.category-item {
cursor: pointer;
padding: 4px;
}
.active {
background: #ededed;
}
.item-title {
background: #d7e7f5 !important;
height: 54px;
}
.no-more {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.wap-tabs { margin-bottom: 12px; }
.wrapper {
background: #fff;
padding: 20px;
display: flex;
}
.category {
flex: 2;
}
.content {
flex: 8;
flex-direction: column;
}
* {
margin: 5px;
}
.list {
min-height: 600px;
position: relative;
}
.item:nth-of-type(2) {
margin: 0 5px;
}
.item {
width: 100% !important;
padding: 0 4px;
display: flex;
align-items: center;
justify-content: space-between;
> .item-config {
width: 180px;
display: flex;
justify-content: space-around;
align-items: center;
}
}
.item:nth-of-type(2n + 1) {
background: #f5f7fa;
}
.mt_10 { margin-top: 10px; }
</style>

View File

@@ -9,7 +9,7 @@
<t-input v-model="searchForm.operatorName" placeholder="请输入操作人" clearable style="width: 240px" />
</t-form-item>
<t-form-item label="创建时间">
<DatePicker type="daterange" v-model="selectDate" format="yyyy-MM-dd" clearable @on-change="selectDateRange" placeholder="选择起始时间" style="width: 240px" />
<t-date-picker v-model="selectDate" mode="date" range clearable format="YYYY-MM-DD" @change="selectDateRange" placeholder="选择起始时间" style="width: 240px" />
</t-form-item>
<t-button theme="primary" class="search-btn" @click="handleSearch">搜索</t-button>
</t-form>
@@ -25,12 +25,12 @@
</t-alert>
</div>
<t-table v-if="showDev" :loading="loading" :columns="columns_dev" :data="data">
<t-table v-if="showDev" :loading="loading" :columns="columns_dev" :data="data" rowKey="id">
<template #createTime="{ row }">
<span>{{ $options.filters.unixToDate(row.createTime / 1000) }}</span>
</template>
</t-table>
<t-table v-else :loading="loading" :columns="columns" :data="data">
<t-table v-else :loading="loading" :columns="columns" :data="data" rowKey="id">
<template #createTime="{ row }">
<span>{{ $options.filters.unixToDate(row.createTime / 1000) }}</span>
</template>

View File

@@ -115,9 +115,13 @@ export default {
},
// 实例化数据
async init() {
this.formValidate = JSON.parse(this.res).paymentSupportItems;
this.checkSupport = JSON.parse(JSON.stringify(this.formValidate));
console.log(this.formValidate);
const parsed = JSON.parse(this.res);
const items = Array.isArray(parsed && parsed.paymentSupportItems) ? parsed.paymentSupportItems : [];
this.formValidate = items.map(it => ({
...it,
supports: Array.isArray(it && it.supports) ? it.supports : []
}));
this.checkSupport = JSON.parse(JSON.stringify(this.formValidate));
await getPaymentSupportForm().then((res) => {
// res.result.payments = ["H5", "PC"];

View File

@@ -1,6 +1,11 @@
<template>
<div class="wrapper">
<Tabs v-model="tabsValue" @on-click="clickType" class="wap-tabs">
<TabPane label="首页" name="STORE"></TabPane>
<TabPane label="专题" name="SPECIAL"></TabPane>
</Tabs>
<Card class="content">
<Button type="primary" @click="handleAdd()">添加页面</Button>
<div class="list">
@@ -45,6 +50,7 @@ export default {
// components: {region},
data() {
return {
tabsValue: 'STORE',
selectedIndex: 0, // 装修那个页面的下标
columns: [ // 表头
{
@@ -88,9 +94,9 @@ export default {
},
methods: {
// 切换tab
clickType(val,index) {
this.params.pageNumber = 1
this.selectedIndex = index
clickType(val) {
this.params.pageNumber = 1;
this.tabsValue = val;
this.params.pageType = val;
},
// 是否发布
@@ -129,13 +135,14 @@ export default {
handleEdit(val) {
this.$router.push({
path: "/floorList/main",
query: { id: val.id, name: val.name, type: val.pageShow },
query: { id: val.id, name: val.name, type: val.pageShow, pagetype: this.params.pageType },
});
},
// 添加模板
handleAdd() {
this.$router.push({
path: "/floorList/main",
query: { pagetype: this.params.pageType },
});
},
// 分页 改变页数
@@ -161,6 +168,7 @@ export default {
};
</script>
<style scoped lang="scss">
.wap-tabs { margin-bottom: 12px; }
.category-item {
cursor: pointer;
padding: 4px;