Compare commits

..

No commits in common. "0e357e530317ea21da126b8e7c7d71d05bd39a78" and "a57ec1f2e4bc495a829e504bbe378f21491c5768" have entirely different histories.

7 changed files with 67 additions and 305 deletions

View File

@ -103,15 +103,6 @@ export const constantRoutes = [
title: "用", fullPath: "/h5HomePage/use", title: "用", fullPath: "/h5HomePage/use",
}, },
}, },
{
path: "details",
title: '产品详情',
component: () => import('@/views/H5/details/index.vue'),
meta: {
title: "产品详情", fullPath: "/h5HomePage/details",
},
}
] ]
}, },
{ {

View File

@ -61,14 +61,10 @@
<div class="item-desc"> <div class="item-desc">
智算 智算
</div> </div>
<!-- 立即咨询和查看详情 --> <!-- 立即咨询 -->
<div class="item-btn"> <div class="item-btn">
<!-- <div class="btn" @click="openConsultDialog(product, thrMenu)"> <div class="btn" @click="openConsultDialog(product, thrMenu)">
立即咨询 立即咨询
</div> -->
<!-- 查看详情 带着id跳转/h5HomePage/details -->
<div class="btn" @click="goToDetail(product.id)">
查看详情
</div> </div>
</div> </div>
</div> </div>
@ -163,17 +159,6 @@ export default {
this.activeSupplierIndex = index this.activeSupplierIndex = index
}, },
//
goToDetail(productId) {
// 使productId
this.$router.push({
path: '/h5HomePage/details',
query: {
id: productId
}
})
},
// //
openConsultDialog(product, category) { openConsultDialog(product, category) {
this.currentProduct = product this.currentProduct = product

View File

@ -1,16 +0,0 @@
<template>
<div>
详情页
</div>
</template>
<script>
export default {
}
</script>
<style lang="less" scoped>
</style>

View File

@ -279,6 +279,7 @@
max-width: 12.8rem; max-width: 12.8rem;
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
z-index: 1;
} }
/* 顶部信息区域 */ /* 顶部信息区域 */
.footer-top { .footer-top {
@ -351,7 +352,7 @@
gap: 0.16rem; gap: 0.16rem;
} }
} }
.footer-center .contact-item .phone-link { .footer-center .contact-item .phone-link {
color: #333; color: #333;
text-decoration: none; text-decoration: none;
transition: all 0.3s; transition: all 0.3s;
@ -359,7 +360,7 @@
font-size: 0.208rem; font-size: 0.208rem;
/* 增大30%: 0.16rem * 1.3 = 0.208rem */ /* 增大30%: 0.16rem * 1.3 = 0.208rem */
} }
.footer-center .contact-item .phone-link:hover { .footer-center .contact-item .phone-link:hover {
color: #275AFF; color: #275AFF;
text-decoration: underline; text-decoration: underline;
} }

View File

@ -288,7 +288,7 @@
max-width: 12.8rem; max-width: 12.8rem;
margin: 0 auto; margin: 0 auto;
position: relative; position: relative;
// z-index: 1; z-index: 1;
} }
/* 顶部信息区域 */ /* 顶部信息区域 */
@ -368,7 +368,10 @@
align-items: center; align-items: center;
gap: 0.16rem; gap: 0.16rem;
} }
}下 }
.center{
// display: flex;
}
.phone-link { .phone-link {
color: #333; color: #333;
text-decoration: none; text-decoration: none;

View File

@ -140,14 +140,13 @@
<div class="footer"> <div class="footer">
<div class="footer-content"> <div class="footer-content">
<!-- 顶部信息 --> <!-- 顶部信息 -->
<div class="footer-center">
<div class="footer-top"> <div class="footer-top">
<div class="logo-footer"> <div class="logo-footer">
<img :src="logoImg" alt="公司logo" v-if="logoImg"> <img :src="logoImg" alt="公司logo" v-if="logoImg">
<!-- <img src="@/assets/kyy/LOGO.png" alt="公司logo" class="img"> --> <!-- <img src="@/assets/kyy/LOGO.png" alt="公司logo" class="img"> -->
</div> </div>
</div> </div>
<div class="footer-center">
<div class="center"> <div class="center">
<div class="contact-item"> <div class="contact-item">
<i class="iconfont icon-dizhi"></i> <i class="iconfont icon-dizhi"></i>
@ -462,5 +461,3 @@ body {
<style lang="less" scoped> <style lang="less" scoped>
@import url('../less/official/index.less'); @import url('../less/official/index.less');
</style> </style>

View File

@ -63,7 +63,7 @@
<!-- 产品列表表格 --> <!-- 产品列表表格 -->
<div class="product-table"> <div class="product-table">
<el-table :data="sortedTableData" style="width: 100%" empty-text="暂无数据" @row-click="handleRowClick"> <el-table :data="tableData" style="width: 100%" empty-text="暂无数据" @row-click="handleRowClick">
<el-table-column label="产品服务名称" min-width="200"> <el-table-column label="产品服务名称" min-width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<div class="product-info"> <div class="product-info">
@ -88,7 +88,7 @@
{{ scope.row.product_group || '--' }} {{ scope.row.product_group || '--' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="sort_order" label="排序" min-width="80" sortable> <el-table-column prop="sort_order" label="排序" min-width="80">
</el-table-column> </el-table-column>
<el-table-column label="操作" min-width="180"> <el-table-column label="操作" min-width="180">
<template slot-scope="scope"> <template slot-scope="scope">
@ -155,8 +155,8 @@
</div> </div>
<!-- 已保存的优势列表 --> <!-- 已保存的优势列表 -->
<div class="saved-list" v-if="sortedAdvantageList.length > 0"> <div class="saved-list" v-if="advantageList.length > 0">
<div class="list-item" v-for="(item, index) in sortedAdvantageList" :key="item.id"> <div class="list-item" v-for="(item, index) in advantageList" :key="item.id">
<div class="item-header"> <div class="item-header">
<div class="item-title">已保存优势 #{{ index + 1 }}</div> <div class="item-title">已保存优势 #{{ index + 1 }}</div>
<div class="item-actions"> <div class="item-actions">
@ -169,7 +169,6 @@
<img :src="item.img" alt="优势图片" style="max-width: 100px; max-height: 100px;"> <img :src="item.img" alt="优势图片" style="max-width: 100px; max-height: 100px;">
</div> </div>
<div class="item-details"> <div class="item-details">
<div><strong>排序</strong>{{ item.sort_order || 1 }} (排在第{{ item.sort_order || 1 }})</div>
<div><strong>标题</strong>{{ item.title }}</div> <div><strong>标题</strong>{{ item.title }}</div>
<div><strong>描述</strong>{{ item.description }}</div> <div><strong>描述</strong>{{ item.description }}</div>
</div> </div>
@ -181,18 +180,10 @@
<div class="form-list"> <div class="form-list">
<div class="form-item" v-for="(form, index) in advantageForms" :key="'advantage_form_' + index"> <div class="form-item" v-for="(form, index) in advantageForms" :key="'advantage_form_' + index">
<div class="form-title"> <div class="form-title">
产品优势 #{{ sortedAdvantageList.length + index + 1 }} 产品优势 #{{ advantageList.length + index + 1 }}
<span v-if="form.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span> <span v-if="form.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span>
</div> </div>
<el-form :model="form" :rules="contentRules" :ref="'advantageForm' + index" label-width="120px"> <el-form :model="form" :rules="contentRules" :ref="'advantageForm' + index" label-width="120px">
<el-form-item label="排序" prop="sort_order">
<el-input-number v-model="form.sort_order" :min="1" :max="100" :step="1"
@change="validateSortOrder('advantage')">
</el-input-number>
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
(值为{{ form.sort_order }}将排在第{{ form.sort_order }})
</span>
</el-form-item>
<el-form-item label="图片" prop="img"> <el-form-item label="图片" prop="img">
<el-input v-model="form.img" placeholder="请输入图片链接"></el-input> <el-input v-model="form.img" placeholder="请输入图片链接"></el-input>
</el-form-item> </el-form-item>
@ -219,8 +210,8 @@
</div> </div>
<!-- 已保存的功能列表 --> <!-- 已保存的功能列表 -->
<div class="saved-list" v-if="sortedFeatureList.length > 0"> <div class="saved-list" v-if="featureList.length > 0">
<div class="list-item" v-for="(item, index) in sortedFeatureList" :key="item.id"> <div class="list-item" v-for="(item, index) in featureList" :key="item.id">
<div class="item-header"> <div class="item-header">
<div class="item-title">已保存功能 #{{ index + 1 }}</div> <div class="item-title">已保存功能 #{{ index + 1 }}</div>
<div class="item-actions"> <div class="item-actions">
@ -230,7 +221,6 @@
</div> </div>
<div class="item-content"> <div class="item-content">
<div class="item-details"> <div class="item-details">
<div><strong>排序</strong>{{ item.sort_order || 1 }} (排在第{{ item.sort_order || 1 }})</div>
<div><strong>标题</strong>{{ item.title }}</div> <div><strong>标题</strong>{{ item.title }}</div>
<div><strong>描述</strong>{{ item.description }}</div> <div><strong>描述</strong>{{ item.description }}</div>
</div> </div>
@ -242,18 +232,10 @@
<div class="form-list"> <div class="form-list">
<div class="form-item" v-for="(form, index) in featureForms" :key="'feature_form_' + index"> <div class="form-item" v-for="(form, index) in featureForms" :key="'feature_form_' + index">
<div class="form-title"> <div class="form-title">
产品功能 #{{ sortedFeatureList.length + index + 1 }} 产品功能 #{{ featureList.length + index + 1 }}
<span v-if="form.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span> <span v-if="form.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span>
</div> </div>
<el-form :model="form" :rules="contentRules" :ref="'featureForm' + index" label-width="120px"> <el-form :model="form" :rules="contentRules" :ref="'featureForm' + index" label-width="120px">
<el-form-item label="排序" prop="sort_order">
<el-input-number v-model="form.sort_order" :min="1" :max="100" :step="1"
@change="validateSortOrder('feature')">
</el-input-number>
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
(值为{{ form.sort_order }}将排在第{{ form.sort_order }})
</span>
</el-form-item>
<el-form-item label="标题" prop="title"> <el-form-item label="标题" prop="title">
<el-input v-model="form.title" placeholder="请输入标题"></el-input> <el-input v-model="form.title" placeholder="请输入标题"></el-input>
</el-form-item> </el-form-item>
@ -277,8 +259,8 @@
</div> </div>
<!-- 已保存的应用列表 --> <!-- 已保存的应用列表 -->
<div class="saved-list" v-if="sortedApplicationMainList.length > 0"> <div class="saved-list" v-if="applicationMainList.length > 0">
<div class="list-item main-item" v-for="(item, index) in sortedApplicationMainList" :key="item.id"> <div class="list-item main-item" v-for="(item, index) in applicationMainList" :key="item.id">
<div class="item-header"> <div class="item-header">
<div class="item-title">已保存应用主项 #{{ index + 1 }}</div> <div class="item-title">已保存应用主项 #{{ index + 1 }}</div>
<div class="item-actions"> <div class="item-actions">
@ -288,7 +270,6 @@
</div> </div>
</div> </div>
<div class="item-content"> <div class="item-content">
<div><strong>排序</strong>{{ item.sort_order || 1 }} (排在第{{ item.sort_order || 1 }})</div>
<div v-if="item.img" class="item-image"> <div v-if="item.img" class="item-image">
<img :src="item.img" alt="应用图片" style="max-width: 100px; max-height: 100px;"> <img :src="item.img" alt="应用图片" style="max-width: 100px; max-height: 100px;">
</div> </div>
@ -300,10 +281,9 @@
<!-- 详情项列表 --> <!-- 详情项列表 -->
<div class="detail-section" v-if="item.subItems && item.subItems.length > 0"> <div class="detail-section" v-if="item.subItems && item.subItems.length > 0">
<div class="detail-list"> <div class="detail-list">
<div class="detail-item" v-for="(detail, detailIndex) in sortedApplicationDetails(item.subItems)" :key="detail.id"> <div class="detail-item" v-for="(detail, detailIndex) in item.subItems" :key="detail.id">
<div class="detail-title">详情项 #{{ detailIndex + 1 }}</div> <div class="detail-title">详情项 #{{ detailIndex + 1 }}</div>
<div class="detail-content"> <div class="detail-content">
<div><strong>排序</strong>{{ detail.sort_order || 1 }} (排在第{{ detail.sort_order || 1 }})</div>
<div><strong>标题</strong>{{ detail.title }}</div> <div><strong>标题</strong>{{ detail.title }}</div>
<div><strong>描述</strong>{{ detail.description }}</div> <div><strong>描述</strong>{{ detail.description }}</div>
</div> </div>
@ -323,13 +303,6 @@
<span v-if="detailForm.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span> <span v-if="detailForm.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span>
</div> </div>
<el-form :model="detailForm" :rules="contentRules" :ref="'appDetailForm_' + item.id + '_' + detailIndex" label-width="120px"> <el-form :model="detailForm" :rules="contentRules" :ref="'appDetailForm_' + item.id + '_' + detailIndex" label-width="120px">
<el-form-item label="排序" prop="sort_order">
<el-input-number v-model="detailForm.sort_order" :min="1" :max="100" :step="1">
</el-input-number>
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
(值为{{ detailForm.sort_order }}将排在第{{ detailForm.sort_order }})
</span>
</el-form-item>
<el-form-item label="标题" prop="title"> <el-form-item label="标题" prop="title">
<el-input v-model="detailForm.title" placeholder="请输入详情标题"></el-input> <el-input v-model="detailForm.title" placeholder="请输入详情标题"></el-input>
</el-form-item> </el-form-item>
@ -352,18 +325,10 @@
<div class="form-list"> <div class="form-list">
<div class="form-item main-form-item" v-for="(form, index) in applicationForms" :key="'application_form_' + index"> <div class="form-item main-form-item" v-for="(form, index) in applicationForms" :key="'application_form_' + index">
<div class="form-title"> <div class="form-title">
应用主项 #{{ sortedApplicationMainList.length + index + 1 }} 应用主项 #{{ applicationMainList.length + index + 1 }}
<span v-if="form.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span> <span v-if="form.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span>
</div> </div>
<el-form :model="form" :rules="contentRules" :ref="'applicationForm' + index" label-width="120px"> <el-form :model="form" :rules="contentRules" :ref="'applicationForm' + index" label-width="120px">
<el-form-item label="排序" prop="sort_order">
<el-input-number v-model="form.sort_order" :min="1" :max="100" :step="1"
@change="validateSortOrder('application')">
</el-input-number>
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
(值为{{ form.sort_order }}将排在第{{ form.sort_order }})
</span>
</el-form-item>
<el-form-item label="标题" prop="title"> <el-form-item label="标题" prop="title">
<el-input v-model="form.title" placeholder="请输入标题"></el-input> <el-input v-model="form.title" placeholder="请输入标题"></el-input>
</el-form-item> </el-form-item>
@ -384,13 +349,6 @@
<span v-if="detailForm.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span> <span v-if="detailForm.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span>
</div> </div>
<el-form :model="detailForm" :rules="contentRules" :ref="'newDetailForm_' + index + '_' + detailIndex" label-width="120px"> <el-form :model="detailForm" :rules="contentRules" :ref="'newDetailForm_' + index + '_' + detailIndex" label-width="120px">
<el-form-item label="排序" prop="sort_order">
<el-input-number v-model="detailForm.sort_order" :min="1" :max="100" :step="1">
</el-input-number>
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
(值为{{ detailForm.sort_order }}将排在第{{ detailForm.sort_order }})
</span>
</el-form-item>
<el-form-item label="标题" prop="title"> <el-form-item label="标题" prop="title">
<el-input v-model="detailForm.title" placeholder="请输入详情标题"></el-input> <el-input v-model="detailForm.title" placeholder="请输入详情标题"></el-input>
</el-form-item> </el-form-item>
@ -421,13 +379,6 @@
<div class="main-product-form"> <div class="main-product-form">
<div class="form-title">产品主信息</div> <div class="form-title">产品主信息</div>
<el-form :model="productIntroForm" :rules="contentRules" ref="productIntroForm" label-width="120px"> <el-form :model="productIntroForm" :rules="contentRules" ref="productIntroForm" label-width="120px">
<el-form-item label="排序" prop="sort_order">
<el-input-number v-model="productIntroForm.sort_order" :min="1" :max="100" :step="1">
</el-input-number>
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
(值为{{ productIntroForm.sort_order }}将排在第{{ productIntroForm.sort_order }})
</span>
</el-form-item>
<el-form-item label="标题" prop="title"> <el-form-item label="标题" prop="title">
<el-input v-model="productIntroForm.title" placeholder="请输入标题"></el-input> <el-input v-model="productIntroForm.title" placeholder="请输入标题"></el-input>
</el-form-item> </el-form-item>
@ -454,8 +405,8 @@
</div> </div>
<!-- 已保存的规格列表 --> <!-- 已保存的规格列表 -->
<div class="saved-list" v-if="sortedProductSpecList.length > 0"> <div class="saved-list" v-if="productSpecList.length > 0">
<div class="list-item" v-for="(item, index) in sortedProductSpecList" :key="item.id"> <div class="list-item" v-for="(item, index) in productSpecList" :key="item.id">
<div class="item-header"> <div class="item-header">
<div class="item-title">已保存规格 #{{ index + 1 }}</div> <div class="item-title">已保存规格 #{{ index + 1 }}</div>
<div class="item-actions"> <div class="item-actions">
@ -464,7 +415,6 @@
</div> </div>
</div> </div>
<div class="item-content"> <div class="item-content">
<div><strong>排序</strong>{{ item.sort_order || 1 }} (排在第{{ item.sort_order || 1 }})</div>
<div v-if="item.icon" class="item-image"> <div v-if="item.icon" class="item-image">
<img :src="item.icon" alt="规格图标" style="max-width: 30px; max-height: 30px;"> <img :src="item.icon" alt="规格图标" style="max-width: 30px; max-height: 30px;">
</div> </div>
@ -480,18 +430,10 @@
<div class="form-list"> <div class="form-list">
<div class="form-item" v-for="(form, index) in productSpecForms" :key="'spec_form_' + index"> <div class="form-item" v-for="(form, index) in productSpecForms" :key="'spec_form_' + index">
<div class="form-title"> <div class="form-title">
产品规格 #{{ sortedProductSpecList.length + index + 1 }} 产品规格 #{{ productSpecList.length + index + 1 }}
<span v-if="form.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span> <span v-if="form.id" style="color: #67c23a; font-size: 12px; margin-left: 8px;">(编辑中)</span>
</div> </div>
<el-form :model="form" :rules="contentRules" :ref="'specForm' + index" label-width="120px"> <el-form :model="form" :rules="contentRules" :ref="'specForm' + index" label-width="120px">
<el-form-item label="排序" prop="sort_order">
<el-input-number v-model="form.sort_order" :min="1" :max="100" :step="1"
@change="validateSortOrder('product_spec')">
</el-input-number>
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
(值为{{ form.sort_order }}将排在第{{ form.sort_order }})
</span>
</el-form-item>
<el-form-item label="名称" prop="name"> <el-form-item label="名称" prop="name">
<el-input v-model="form.name" placeholder="请输入名称"></el-input> <el-input v-model="form.name" placeholder="请输入名称"></el-input>
</el-form-item> </el-form-item>
@ -528,10 +470,7 @@
<el-input v-model="menuDialog.form.title" placeholder="请输入菜单标题"></el-input> <el-input v-model="menuDialog.form.title" placeholder="请输入菜单标题"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="sort_order"> <el-form-item label="排序" prop="sort_order">
<el-input-number v-model="menuDialog.form.sort_order" :min="0" :max="100"></el-input-number> <el-input-number v-model="menuDialog.form.sort_order" :min="1" :max="100"></el-input-number>
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
(值为{{ menuDialog.form.sort_order }}将排在第{{ menuDialog.form.sort_order+1 }})
</span>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -566,9 +505,6 @@
</el-form-item> </el-form-item>
<el-form-item label="排序" prop="sort_order"> <el-form-item label="排序" prop="sort_order">
<el-input-number v-model="productDialog.form.sort_order" :min="1" :max="100"></el-input-number> <el-input-number v-model="productDialog.form.sort_order" :min="1" :max="100"></el-input-number>
<span class="sort-order-hint" style="margin-left: 8px; color: #909399; font-size: 12px;">
(值为{{ productDialog.form.sort_order }}将排在第{{ productDialog.form.sort_order }})
</span>
</el-form-item> </el-form-item>
</el-form> </el-form>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@ -619,8 +555,7 @@ export default {
pre_price: '', pre_price: '',
price_unit: '', price_unit: '',
discount: 0, discount: 0,
bg_img_url: '', bg_img_url: ''
sort_order: 1
}, },
// //
@ -708,9 +643,6 @@ export default {
], ],
bg_img_url: [ bg_img_url: [
{ required: true, message: '请输入背景图链接', trigger: 'blur' } { required: true, message: '请输入背景图链接', trigger: 'blur' }
],
sort_order: [
{ required: true, message: '请输入排序值', trigger: 'blur' }
] ]
}, },
@ -748,38 +680,6 @@ export default {
} }
} }
}, },
computed: {
// sort_order
sortedTableData() {
return [...this.tableData].sort((a, b) => {
return (a.sort_order || 999) - (b.sort_order || 999)
})
},
// sort_order
sortedAdvantageList() {
return [...this.advantageList].sort((a, b) => {
return (a.sort_order || 999) - (b.sort_order || 999)
})
},
// sort_order
sortedFeatureList() {
return [...this.featureList].sort((a, b) => {
return (a.sort_order || 999) - (b.sort_order || 999)
})
},
// sort_order
sortedApplicationMainList() {
return [...this.applicationMainList].sort((a, b) => {
return (a.sort_order || 999) - (b.sort_order || 999)
})
},
// sort_order
sortedProductSpecList() {
return [...this.productSpecList].sort((a, b) => {
return (a.sort_order || 999) - (b.sort_order || 999)
})
}
},
created() { created() {
this.loadMenuTree() this.loadMenuTree()
}, },
@ -838,8 +738,7 @@ export default {
img: item.img, img: item.img,
icon: item.icon, icon: item.icon,
menu_product_id: this.selectedProduct.id, menu_product_id: this.selectedProduct.id,
content_type: 'advantage', content_type: 'advantage'
sort_order: item.sort_order || 1
})) }))
console.log('优势数据回显成功:', this.advantageList) console.log('优势数据回显成功:', this.advantageList)
} else { } else {
@ -855,8 +754,7 @@ export default {
img: item.img, img: item.img,
icon: item.icon, icon: item.icon,
menu_product_id: this.selectedProduct.id, menu_product_id: this.selectedProduct.id,
content_type: 'feature', content_type: 'feature'
sort_order: item.sort_order || 1
})) }))
console.log('功能数据回显成功:', this.featureList) console.log('功能数据回显成功:', this.featureList)
} else { } else {
@ -878,8 +776,7 @@ export default {
icon: app.icon, icon: app.icon,
menu_product_id: this.selectedProduct.id, menu_product_id: this.selectedProduct.id,
content_type: 'application', content_type: 'application',
description: app.description || '', description: app.description || ''
sort_order: app.sort_order || 1
} }
// providesubItems // providesubItems
@ -891,8 +788,7 @@ export default {
description: provideItem.description, description: provideItem.description,
parent_id: app.id, parent_id: app.id,
menu_product_id: this.selectedProduct.id, menu_product_id: this.selectedProduct.id,
content_type: 'application', content_type: 'application'
sort_order: provideItem.sort_order || 1
})) }))
} else { } else {
mainItem.subItems = [] mainItem.subItems = []
@ -922,8 +818,7 @@ export default {
pre_price: productData.pre_price || '', pre_price: productData.pre_price || '',
price_unit: productData.price_unit || '', price_unit: productData.price_unit || '',
discount: productData.discount || 0, discount: productData.discount || 0,
bg_img_url: productData.bg_img_url || '', bg_img_url: productData.bg_img_url || ''
sort_order: productData.sort_order || 1
} }
console.log('产品主信息回显成功:', this.productIntroForm) console.log('产品主信息回显成功:', this.productIntroForm)
@ -937,8 +832,7 @@ export default {
icon: item.icon, icon: item.icon,
menu_product_id: this.selectedProduct.id, menu_product_id: this.selectedProduct.id,
content_type: 'product', content_type: 'product',
parent_id: productData.id, parent_id: productData.id
sort_order: item.sort_order || 1
})) }))
console.log('规格数据回显成功:', this.productSpecList) console.log('规格数据回显成功:', this.productSpecList)
} else { } else {
@ -949,8 +843,7 @@ export default {
this.productIntroForm = { this.productIntroForm = {
...this.productIntroForm, ...this.productIntroForm,
title: data.title || '', title: data.title || '',
description: data.description || '', description: data.description || ''
sort_order: 1
} }
this.productSpecList = [] this.productSpecList = []
} }
@ -977,8 +870,7 @@ export default {
const baseForm = { const baseForm = {
menu_product_id: this.selectedProduct ? this.selectedProduct.id : '', menu_product_id: this.selectedProduct ? this.selectedProduct.id : '',
content_type: this.getContentTypeForAPI(type), content_type: this.getContentTypeForAPI(type),
id: '', id: ''
sort_order: 1 // 1
} }
switch (type) { switch (type) {
@ -1072,8 +964,7 @@ export default {
content_type: 'application', content_type: 'application',
parent_id: parentId.toString().startsWith('new_') ? '' : parentId, parent_id: parentId.toString().startsWith('new_') ? '' : parentId,
title: '', title: '',
description: '', description: ''
sort_order: 1 // 1
} }
this.applicationDetailForms[parentId].push(newDetailForm) this.applicationDetailForms[parentId].push(newDetailForm)
@ -1104,33 +995,6 @@ export default {
} }
}, },
//
validateSortOrder(type) {
let forms = []
switch (type) {
case 'advantage':
forms = this.advantageForms
break
case 'feature':
forms = this.featureForms
break
case 'application':
forms = this.applicationForms
break
case 'product_spec':
forms = this.productSpecForms
break
}
//
const sortOrders = forms.map(form => form.sort_order)
const duplicates = sortOrders.filter((item, index) => sortOrders.indexOf(item) !== index)
if (duplicates.length > 0) {
this.$message.warning('排序值不能重复,相同的排序值将按照保存顺序排列')
}
},
// //
editSavedItem(item, type) { editSavedItem(item, type) {
console.log('编辑已保存项:', item, type); console.log('编辑已保存项:', item, type);
@ -1171,8 +1035,7 @@ export default {
content_type: 'advantage', content_type: 'advantage',
img: item.img || '', img: item.img || '',
title: item.title || '', title: item.title || '',
description: item.description || '', description: item.description || ''
sort_order: item.sort_order || 1
}); });
this.advantageList = this.advantageList.filter(i => i.id !== item.id); this.advantageList = this.advantageList.filter(i => i.id !== item.id);
break; break;
@ -1183,8 +1046,7 @@ export default {
menu_product_id: item.menu_product_id, menu_product_id: item.menu_product_id,
content_type: 'feature', content_type: 'feature',
title: item.title || '', title: item.title || '',
description: item.description || '', description: item.description || ''
sort_order: item.sort_order || 1
}); });
this.featureList = this.featureList.filter(i => i.id !== item.id); this.featureList = this.featureList.filter(i => i.id !== item.id);
break; break;
@ -1195,8 +1057,7 @@ export default {
menu_product_id: item.menu_product_id, menu_product_id: item.menu_product_id,
content_type: 'application', content_type: 'application',
title: item.title || '', title: item.title || '',
img: item.img || '', img: item.img || ''
sort_order: item.sort_order || 1
}); });
this.applicationMainList = this.applicationMainList.filter(i => i.id !== item.id); this.applicationMainList = this.applicationMainList.filter(i => i.id !== item.id);
@ -1220,8 +1081,7 @@ export default {
content_type: 'application', content_type: 'application',
parent_id: detail.parent_id || item.id, parent_id: detail.parent_id || item.id,
title: detail.title || '', title: detail.title || '',
description: detail.description || '', description: detail.description || ''
sort_order: detail.sort_order || 1
}); });
} }
}); });
@ -1245,8 +1105,7 @@ export default {
content_type: 'application', content_type: 'application',
parent_id: item.parent_id || parentItem.id, parent_id: item.parent_id || parentItem.id,
title: item.title || '', title: item.title || '',
description: item.description || '', description: item.description || ''
sort_order: item.sort_order || 1
}); });
// subItems // subItems
@ -1262,8 +1121,7 @@ export default {
parent_id: item.parent_id || '', parent_id: item.parent_id || '',
name: item.name || '', name: item.name || '',
description: item.description || '', description: item.description || '',
icon: item.icon || '', icon: item.icon || ''
sort_order: item.sort_order || 1
}); });
this.productSpecList = this.productSpecList.filter(i => i.id !== item.id); this.productSpecList = this.productSpecList.filter(i => i.id !== item.id);
break; break;
@ -1272,14 +1130,6 @@ export default {
this.$message.success('已移动到编辑区域,请修改后点击保存'); this.$message.success('已移动到编辑区域,请修改后点击保存');
}, },
//
sortedApplicationDetails(subItems) {
if (!subItems || !Array.isArray(subItems)) return []
return [...subItems].sort((a, b) => {
return (a.sort_order || 999) - (b.sort_order || 999)
})
},
// //
deleteContentItem(id, type) { deleteContentItem(id, type) {
this.$confirm('确定删除该项吗?', '提示', { this.$confirm('确定删除该项吗?', '提示', {
@ -1410,11 +1260,6 @@ export default {
formData.menu_product_id = this.selectedProduct.id formData.menu_product_id = this.selectedProduct.id
} }
// sort_order
if (!formData.sort_order) {
formData.sort_order = 1
}
formsToSave.push(formData) formsToSave.push(formData)
} }
@ -1469,11 +1314,6 @@ export default {
formData.menu_product_id = this.selectedProduct.id formData.menu_product_id = this.selectedProduct.id
} }
// sort_order
if (!formData.sort_order) {
formData.sort_order = 1
}
formsToSave.push(formData) formsToSave.push(formData)
} }
@ -1526,11 +1366,6 @@ export default {
formData.menu_product_id = this.selectedProduct.id formData.menu_product_id = this.selectedProduct.id
} }
// sort_order
if (!formData.sort_order) {
formData.sort_order = 1
}
if (formData.id) { if (formData.id) {
// //
const res = await updateProductIntroAPI(formData) const res = await updateProductIntroAPI(formData)
@ -1587,11 +1422,6 @@ export default {
detailData.menu_product_id = this.selectedProduct.id detailData.menu_product_id = this.selectedProduct.id
} }
// sort_order
if (!detailData.sort_order) {
detailData.sort_order = 1
}
if (detailData.id) { if (detailData.id) {
const res = await updateProductIntroAPI(detailData) const res = await updateProductIntroAPI(detailData)
if (res.status !== true) { if (res.status !== true) {
@ -1631,11 +1461,6 @@ export default {
mainData.menu_product_id = this.selectedProduct.id mainData.menu_product_id = this.selectedProduct.id
} }
// sort_order
if (!mainData.sort_order) {
mainData.sort_order = 1
}
let mainId = mainData.id let mainId = mainData.id
if (mainData.id) { if (mainData.id) {
@ -1667,11 +1492,6 @@ export default {
formData.menu_product_id = this.selectedProduct.id formData.menu_product_id = this.selectedProduct.id
} }
// sort_order
if (!formData.sort_order) {
formData.sort_order = 1
}
if (formData.id) { if (formData.id) {
const res = await updateProductIntroAPI(formData) const res = await updateProductIntroAPI(formData)
if (res.status !== true) { if (res.status !== true) {
@ -1704,47 +1524,28 @@ export default {
} }
}, },
// - sort_order // -
buildMenuTree(menus) { buildMenuTree(menus) {
// const transformedData = menus.map(level1 => ({
const sortedLevel1 = [...menus].sort((a, b) => {
return (a.sort_order || 999) - (b.sort_order || 999)
})
const transformedData = sortedLevel1.map(level1 => {
//
const sortedLevel2 = [...(level1.secMenu || [])].sort((a, b) => {
return (a.sort_order || 999) - (b.sort_order || 999)
})
return {
id: level1.id, id: level1.id,
title: level1.firTitle, title: level1.firTitle,
menu_level: 1, menu_level: 1,
sort_order: level1.sort_order || 1, sort_order: level1.sort_order || 1,
children: sortedLevel2.map(level2 => { children: (level1.secMenu || []).map(level2 => ({
//
const sortedLevel3 = [...(level2.thrMenu || [])].sort((a, b) => {
return (a.sort_order || 999) - (b.sort_order || 999)
})
return {
id: level2.id, id: level2.id,
title: level2.secTitle, title: level2.secTitle,
menu_level: 2, menu_level: 2,
parent_id: level1.id, parent_id: level1.id,
sort_order: level2.sort_order || 1, sort_order: level2.sort_order || 1,
children: sortedLevel3.map(level3 => ({ children: (level2.thrMenu || []).map(level3 => ({
id: level3.id, id: level3.id,
title: level3.thrTitle, title: level3.thrTitle,
menu_level: 3, menu_level: 3,
parent_id: level2.id, parent_id: level2.id,
sort_order: level3.sort_order || 1 sort_order: level3.sort_order || 1
})) }))
} }))
}) }))
}
})
return transformedData return transformedData
}, },
@ -1906,7 +1707,7 @@ export default {
this.menuDialog.form = { this.menuDialog.form = {
id: '', id: '',
title: '', title: '',
sort_order: 0, sort_order: 1,
menu_level: data.menu_level + 1, menu_level: data.menu_level + 1,
parent_id: data.id parent_id: data.id
} }