This commit is contained in:
2025-08-19 01:45:46 +08:00
12 changed files with 2019 additions and 176 deletions

View File

@@ -9,6 +9,6 @@ VUE_APP_BASE_API = ''
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
VUE_APP_BASE_API = 'http://127.0.0.1:30313'
VUE_APP_BASE_API = 'http://134.175.126.60:30313'
# VUE_APP_BASE_API = 'http://127.0.0.1:30313'
port = 8888

View File

@@ -1,16 +1,16 @@
<template>
<div id="app">
<router-view />
<theme-picker />
<!-- <theme-picker /> -->
</div>
</template>
<script>
import ThemePicker from "@/components/ThemePicker"
// import ThemePicker from "@/components/ThemePicker"
export default {
name: "App",
components: { ThemePicker }
name: "App"
// components: { ThemePicker }
}
</script>
<style scoped>

View File

@@ -0,0 +1,60 @@
import request from '@/utils/request'
// 查询商品错误提示列表
export function listPrdErrorTip(query) {
return request({
url: '/jarvis/prdErrorTip/list',
method: 'get',
params: query
})
}
// 查询商品错误提示详细
export function getPrdErrorTip(id) {
return request({
url: '/jarvis/prdErrorTip/' + id,
method: 'get'
})
}
// 新增商品错误提示
export function addPrdErrorTip(data) {
return request({
url: '/jarvis/prdErrorTip',
method: 'post',
data: data
})
}
// 修改商品错误提示
export function updatePrdErrorTip(data) {
return request({
url: '/jarvis/prdErrorTip',
method: 'put',
data: data
})
}
// 删除商品错误提示
export function delPrdErrorTip(id) {
return request({
url: '/jarvis/prdErrorTip/' + id,
method: 'delete'
})
}
// 批量删除商品错误提示
export function delPrdErrorTips(ids) {
return request({
url: '/jarvis/prdErrorTip/' + ids,
method: 'delete'
})
}
// 根据错误代码和子代码查询错误提示
export function getPrdErrorTipByCode(errCode, errSubCode) {
return request({
url: '/jarvis/prdErrorTip/getByCode/' + errCode + '/' + errSubCode,
method: 'get'
})
}

View File

@@ -0,0 +1,87 @@
// 自定义侧边栏样式 - 适配蓝色渐变背景
.sidebar-container {
// 覆盖Element UI菜单的默认样式
.el-menu {
background: transparent !important;
border: none !important;
.el-menu-item, .el-submenu__title {
color: #ffffff !important;
background: transparent !important;
&:hover {
background-color: rgba(255, 255, 255, 0.1) !important;
color: #ffffff !important;
}
&.is-active {
background-color: rgba(255, 255, 255, 0.2) !important;
color: #ffffff !important;
border-right: 3px solid #ffffff !important;
}
}
.el-submenu {
.el-menu {
background-color: rgba(255, 255, 255, 0.05) !important;
.el-menu-item {
&:hover {
background-color: rgba(255, 255, 255, 0.1) !important;
}
&.is-active {
background-color: rgba(255, 255, 255, 0.15) !important;
color: #ffffff !important;
}
}
}
}
}
// 图标颜色
.svg-icon {
color: #ffffff !important;
}
// 文字颜色
span {
color: #ffffff !important;
}
// 激活状态的子菜单标题
.is-active > .el-submenu__title {
color: #ffffff !important;
}
// 子菜单展开时的样式
.el-submenu.is-opened > .el-submenu__title {
color: #ffffff !important;
}
}
// 弹出菜单样式
.el-menu--popup {
background: linear-gradient(135deg, #3aa4ef 0%, #0067e2 100%) !important;
border-radius: 8px !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
.el-menu-item {
color: #ffffff !important;
&:hover {
background-color: rgba(255, 255, 255, 0.1) !important;
}
&.is-active {
background-color: rgba(255, 255, 255, 0.2) !important;
}
}
}
// 响应式设计
@media (max-width: 768px) {
.sidebar-container {
border-radius: 0 !important;
}
}

View File

@@ -3,6 +3,7 @@
@import './transition.scss';
@import './element-ui.scss';
@import './sidebar.scss';
@import './custom-sidebar.scss';
@import './btn.scss';
body {

View File

@@ -15,8 +15,8 @@
-webkit-transition: width .28s;
transition: width 0.28s;
width: $base-sidebar-width !important;
background-color: $base-menu-background;
height: 100%;
background: $base-menu-background;
height: 100vh;
position: fixed;
font-size: 0px;
top: 0;
@@ -24,6 +24,7 @@
left: 0;
z-index: 1001;
overflow: hidden;
border-radius: 0 24px 0 0;
-webkit-box-shadow: 2px 0 6px rgba(0,21,41,.35);
box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1);
@@ -46,7 +47,7 @@
&.has-logo {
.el-scrollbar {
height: calc(100% - 50px);
height: calc(100% - 60px);
}
}
@@ -68,19 +69,21 @@
border: none;
height: 100%;
width: 100% !important;
font-size: 15px; // 增加菜单字体大小
}
.el-menu-item, .el-submenu__title {
overflow: hidden !important;
text-overflow: ellipsis !important;
white-space: nowrap !important;
font-size: 15px; // 确保菜单项字体大小一致
}
// menu hover
.submenu-title-noDropdown,
.el-submenu__title {
&:hover {
background-color: rgba(0, 0, 0, 0.06) !important;
background-color: rgba(255, 255, 255, 0.1) !important;
}
}
@@ -93,7 +96,7 @@
min-width: $base-sidebar-width !important;
&:hover {
background-color: rgba(0, 0, 0, 0.06) !important;
background-color: rgba(255, 255, 255, 0.1) !important;
}
}
@@ -202,7 +205,7 @@
.el-menu-item {
&:hover {
// you can use $subMenuHover
background-color: rgba(0, 0, 0, 0.06) !important;
background-color: rgba(58, 164, 239, 0.1) !important;
}
}

View File

@@ -8,18 +8,18 @@ $tiffany: #4AB7BD;
$yellow:#FEC171;
$panGreen: #30B08F;
// 默认菜单主题风格
$base-menu-color:#bfcbd9;
$base-menu-color-active:#f4f4f5;
$base-menu-background:#304156;
// 默认菜单主题风格 - 蓝色渐变主题
$base-menu-color:#ffffff;
$base-menu-color-active:#ffffff;
$base-menu-background:linear-gradient(0deg, #3aa4ef 0%, #0067e2 100%);
$base-logo-title-color: #ffffff;
$base-menu-light-color:rgba(0,0,0,.70);
$base-menu-light-background:#ffffff;
$base-logo-light-title-color: #001529;
$base-sub-menu-background:#1f2d3d;
$base-sub-menu-hover:#001528;
$base-sub-menu-background:rgba(255,255,255,0.1);
$base-sub-menu-hover:rgba(255,255,255,0.2);
// 自定义暗色菜单风格
/**

View File

@@ -2,40 +2,7 @@
<el-drawer size="280px" :visible="showSettings" :with-header="false" :append-to-body="true" :before-close="closeSetting" :lock-scroll="false">
<div class="drawer-container">
<div>
<div class="setting-drawer-content">
<div class="setting-drawer-title">
<h3 class="drawer-title">主题风格设置</h3>
</div>
<div class="setting-drawer-block-checbox">
<div class="setting-drawer-block-checbox-item" @click="handleTheme('theme-dark')">
<img src="@/assets/images/dark.svg" alt="dark">
<div v-if="sideTheme === 'theme-dark'" class="setting-drawer-block-checbox-selectIcon" style="display: block;">
<i aria-label="图标: check" class="anticon anticon-check">
<svg viewBox="64 64 896 896" data-icon="check" width="1em" height="1em" :fill="theme" aria-hidden="true" focusable="false" class="">
<path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"/>
</svg>
</i>
</div>
</div>
<div class="setting-drawer-block-checbox-item" @click="handleTheme('theme-light')">
<img src="@/assets/images/light.svg" alt="light">
<div v-if="sideTheme === 'theme-light'" class="setting-drawer-block-checbox-selectIcon" style="display: block;">
<i aria-label="图标: check" class="anticon anticon-check">
<svg viewBox="64 64 896 896" data-icon="check" width="1em" height="1em" :fill="theme" aria-hidden="true" focusable="false" class="">
<path d="M912 190h-69.9c-9.8 0-19.1 4.5-25.1 12.2L404.7 724.5 207 474a32 32 0 0 0-25.1-12.2H112c-6.7 0-10.4 7.7-6.3 12.9l273.9 347c12.8 16.2 37.4 16.2 50.3 0l488.4-618.9c4.1-5.1.4-12.8-6.3-12.8z"/>
</svg>
</i>
</div>
</div>
</div>
<div class="drawer-item">
<span>主题颜色</span>
<theme-picker style="float: right;height: 26px;margin: -3px 8px 0 0;" @change="themeChange" />
</div>
</div>
<el-divider/>
<!-- 主题风格设置已完全移除避免与自定义侧边栏样式冲突 -->
<h3 class="drawer-title">系统布局配置</h3>
@@ -84,15 +51,13 @@
</template>
<script>
import ThemePicker from '@/components/ThemePicker'
// import ThemePicker from '@/components/ThemePicker'
export default {
components: { ThemePicker },
// components: { ThemePicker },
expose: ['openSetting'],
data() {
return {
theme: this.$store.state.settings.theme,
sideTheme: this.$store.state.settings.sideTheme,
showSettings: false
}
},
@@ -181,20 +146,6 @@ export default {
}
},
methods: {
themeChange(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'theme',
value: val
})
this.theme = val
},
handleTheme(val) {
this.$store.dispatch('settings/changeSetting', {
key: 'sideTheme',
value: val
})
this.sideTheme = val
},
openSetting() {
this.showSettings = true
},
@@ -212,9 +163,7 @@ export default {
"fixedHeader":${this.fixedHeader},
"sidebarLogo":${this.sidebarLogo},
"dynamicTitle":${this.dynamicTitle},
"footerVisible":${this.footerVisible},
"sideTheme":"${this.sideTheme}",
"theme":"${this.theme}"
"footerVisible":${this.footerVisible}
}`
)
setTimeout(this.$modal.closeLoading(), 1000)
@@ -229,48 +178,7 @@ export default {
</script>
<style lang="scss" scoped>
.setting-drawer-content {
.setting-drawer-title {
margin-bottom: 12px;
color: rgba(0, 0, 0, .85);
font-size: 14px;
line-height: 22px;
font-weight: bold;
}
.setting-drawer-block-checbox {
display: flex;
justify-content: flex-start;
align-items: center;
margin-top: 10px;
margin-bottom: 20px;
.setting-drawer-block-checbox-item {
position: relative;
margin-right: 16px;
border-radius: 2px;
cursor: pointer;
img {
width: 48px;
height: 48px;
}
.setting-drawer-block-checbox-selectIcon {
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
padding-top: 15px;
padding-left: 24px;
color: #1890ff;
font-weight: 700;
font-size: 14px;
}
}
}
}
/* 主题风格设置相关样式已移除 */
.drawer-container {
padding: 20px;

View File

@@ -1,13 +1,16 @@
<template>
<div class="sidebar-logo-container" :class="{'collapse':collapse}" :style="{ backgroundColor: sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground }">
<div class="sidebar-logo-container" :class="{'collapse':collapse}">
<transition name="sidebarLogoFade">
<router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
<h1 v-else class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
<div class="logo-icon">
<i class="el-icon-shopping-cart-2"></i>
</div>
</router-link>
<router-link v-else key="expand" class="sidebar-logo-link" to="/">
<img v-if="logo" :src="logo" class="sidebar-logo" />
<h1 class="sidebar-title" :style="{ color: sideTheme === 'theme-dark' ? variables.logoTitleColor : variables.logoLightTitleColor }">{{ title }} </h1>
<div class="logo-icon">
<i class="el-icon-shopping-cart-2"></i>
</div>
<h1 class="sidebar-title">{{ title }}</h1>
</router-link>
</transition>
</div>
@@ -55,21 +58,46 @@ export default {
.sidebar-logo-container {
position: relative;
width: 100%;
height: 50px;
line-height: 50px;
background: #2b2f3a;
height: 60px;
line-height: 60px;
background: linear-gradient(90deg, #3aa4ef 0%, #0067e2 100%);
text-align: center;
overflow: hidden;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
& .sidebar-logo-link {
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
padding: 0 20px;
& .sidebar-logo {
width: 32px;
height: 32px;
vertical-align: middle;
margin-right: 12px;
& .logo-icon {
display: flex;
align-items: center;
justify-content: center;
width: 42px;
height: 42px;
background: rgba(255, 255, 255, 0.15);
border: 2px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
margin-right: 15px;
transition: all 0.3s ease;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
i {
font-size: 22px;
color: #ffffff;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
&:hover {
background: rgba(255, 255, 255, 0.25);
border-color: rgba(255, 255, 255, 0.5);
transform: scale(1.05);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
}
& .sidebar-title {
@@ -77,16 +105,20 @@ export default {
margin: 0;
color: #fff;
font-weight: 600;
line-height: 50px;
font-size: 14px;
font-size: 16px;
font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
vertical-align: middle;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
}
&.collapse {
.sidebar-logo {
margin-right: 0px;
.logo-icon {
margin-right: 0;
}
.sidebar-title {
display: none;
}
}
}

View File

@@ -94,7 +94,7 @@ export const constantRoutes = [
component: Layout,
redirect: 'list',
name: 'Order',
meta: { title: '京粉订单', icon: 'shopping' },
meta: { title: '京粉订单', icon: 'money' },
children: [
{
path: 'list',
@@ -116,37 +116,6 @@ export const constantRoutes = [
}
]
},
{
path: '/message',
component: Layout,
redirect: 'noredirect',
name: 'Message',
meta: { title: '线报消息', icon: 'message' },
children: [
{
path: 'index',
component: () => import('@/views/system/xbmessage/index'),
name: 'MessageIndex',
meta: { title: '线报消息', icon: 'list' }
}
]
},
{
path: '/xbgroup',
component: Layout,
redirect: 'noredirect',
name: 'Xbgroup',
meta: { title: '线报群管理', icon: 'peoples' },
children: [
{
path: 'index',
component: () => import('@/views/system/xbgroup/index'),
name: 'XbgroupIndex',
meta: { title: '线报群列表', icon: 'list' }
}
]
},
{
path: '/jdorder',
component: Layout,
@@ -162,6 +131,51 @@ export const constantRoutes = [
}
]
},
{
path: '/favorite',
component: Layout,
redirect: 'noredirect',
name: 'Favorite',
meta: { title: '常用商品', icon: 'star' },
children: [
{
path: 'index',
component: () => import('@/views/system/favoriteProduct/index'),
name: 'FavoriteIndex',
meta: { title: '常用商品', icon: 'shopping' }
}
]
},
{
path: '/message',
component: Layout,
redirect: 'noredirect',
name: 'Message',
meta: { title: '线报消息', icon: 'message' },
children: [
{
path: 'index',
component: () => import('@/views/system/xbmessage/index'),
name: 'MessageIndex',
meta: { title: '线报消息', icon: 'wechat' }
}
]
},
{
path: '/xbgroup',
component: Layout,
redirect: 'noredirect',
name: 'Xbgroup',
meta: { title: '线报群管理', icon: 'peoples' },
children: [
{
path: 'index',
component: () => import('@/views/system/xbgroup/index'),
name: 'XbgroupIndex',
meta: { title: '线报群列表', icon: 'peoples' }
}
]
},
{
path: '/system',
component: Layout,
@@ -173,7 +187,7 @@ export const constantRoutes = [
path: 'superadmin',
component: () => import('@/views/system/superadmin/index'),
name: 'Superadmin',
meta: { title: '超级管理员', icon: 'user' }
meta: { title: '超级管理员', icon: 'people' }
}
]
},

View File

@@ -0,0 +1,631 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="商品名称" prop="productName">
<el-input
v-model="queryParams.productName"
placeholder="请输入商品名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="店铺名称" prop="shopName">
<el-input
v-model="queryParams.shopName"
placeholder="请输入店铺名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="SKUID" prop="skuid">
<el-input
v-model="queryParams.skuid"
placeholder="请输入SKUID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否置顶" prop="isTop">
<el-select v-model="queryParams.isTop" placeholder="请选择" clearable>
<el-option label="是" :value="1" />
<el-option label="否" :value="0" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['jarvis:favoriteProduct:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['jarvis:favoriteProduct:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['jarvis:favoriteProduct:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-top"
size="mini"
:disabled="multiple"
@click="handleBatchTop"
v-hasPermi="['jarvis:favoriteProduct:edit']"
>批量置顶</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['jarvis:favoriteProduct:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="favoriteProductList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="商品图片" align="center" prop="productImage" width="100">
<template slot-scope="scope">
<el-image
v-if="scope.row.productImage"
:src="scope.row.productImage"
:preview-src-list="[scope.row.productImage]"
style="width: 60px; height: 60px; border-radius: 4px;"
fit="cover"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="商品名称" align="left" prop="productName" min-width="200" :show-overflow-tooltip="true">
<template slot-scope="scope">
<div>
<div style="font-weight: bold; margin-bottom: 5px;">
<el-tag v-if="scope.row.isTop === 1" type="danger" size="mini">置顶</el-tag>
{{ scope.row.productName }}
</div>
<div style="color: #666; font-size: 12px;">
SKUID: {{ scope.row.skuid }}
</div>
</div>
</template>
</el-table-column>
<el-table-column label="店铺信息" align="left" prop="shopName" min-width="150">
<template slot-scope="scope">
<div>
<div>{{ scope.row.shopName }}</div>
<div style="color: #666; font-size: 12px;">ID: {{ scope.row.shopId }}</div>
</div>
</template>
</el-table-column>
<el-table-column label="价格信息" align="center" prop="price" width="120">
<template slot-scope="scope">
<div>
<div style="color: #f56c6c; font-weight: bold;">¥{{ scope.row.price || '-' }}</div>
<div v-if="scope.row.commissionInfo" style="color: #67c23a; font-size: 12px;">
佣金: {{ scope.row.commissionInfo }}
</div>
</div>
</template>
</el-table-column>
<el-table-column label="ERP商品" align="center" prop="erpProductIds" width="120">
<template slot-scope="scope">
<el-button
v-if="scope.row.erpProductIds"
type="text"
size="mini"
@click="showErpProducts(scope.row)"
>
查看({{ JSON.parse(scope.row.erpProductIds || '[]').length }})
</el-button>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="使用统计" align="center" width="120">
<template slot-scope="scope">
<div>
<div>使用: {{ scope.row.useCount || 0 }}</div>
<div style="color: #666; font-size: 12px;">
{{ scope.row.lastUsedTime || '未使用' }}
</div>
</div>
</template>
</el-table-column>
<el-table-column label="创建信息" align="center" width="150">
<template slot-scope="scope">
<div>
<div>{{ scope.row.createUserName }}</div>
<div style="color: #666; font-size: 12px;">
{{ parseTime(scope.row.createTime) }}
</div>
</div>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-view"
@click="handleView(scope.row)"
>查看</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['jarvis:favoriteProduct:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-top"
@click="handleTop(scope.row)"
v-hasPermi="['jarvis:favoriteProduct:edit']"
>
{{ scope.row.isTop === 1 ? '取消置顶' : '置顶' }}
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-shopping-cart-2"
@click="handleQuickPublish(scope.row)"
>快速发品</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['jarvis:favoriteProduct:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改常用商品对话框 -->
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row>
<el-col :span="12">
<el-form-item label="SKUID" prop="skuid">
<el-input v-model="form.skuid" placeholder="请输入SKUID" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商品名称" prop="productName">
<el-input v-model="form.productName" placeholder="请输入商品名称" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="店铺名称" prop="shopName">
<el-input v-model="form.shopName" placeholder="请输入店铺名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="店铺ID" prop="shopId">
<el-input v-model="form.shopId" placeholder="请输入店铺ID" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="商品链接" prop="productUrl">
<el-input v-model="form.productUrl" placeholder="请输入商品链接" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商品图片" prop="productImage">
<el-input v-model="form.productImage" placeholder="请输入商品图片URL" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="商品价格" prop="price">
<el-input v-model="form.price" placeholder="请输入商品价格" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="佣金信息" prop="commissionInfo">
<el-input v-model="form.commissionInfo" placeholder="请输入佣金信息" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="商品分类" prop="category">
<el-input v-model="form.category" placeholder="请输入商品分类" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="商品品牌" prop="brand">
<el-input v-model="form.brand" placeholder="请输入商品品牌" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="是否置顶" prop="isTop">
<el-radio-group v-model="form.isTop">
<el-radio :label="1"></el-radio>
<el-radio :label="0"></el-radio>
</el-radio-group>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="排序权重" prop="sortWeight">
<el-input-number v-model="form.sortWeight" :min="0" :max="999" />
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!-- ERP商品详情对话框 -->
<el-dialog title="ERP商品详情" :visible.sync="erpDialogVisible" width="800px" append-to-body>
<el-table :data="erpProducts" border style="width: 100%">
<el-table-column label="ERP应用ID" prop="appid" width="120" />
<el-table-column label="ERP商品ID" prop="erpProductId" width="120" />
<el-table-column label="商品标题" prop="erpProductTitle" min-width="200" :show-overflow-tooltip="true" />
<el-table-column label="商品状态" prop="erpProductStatus" width="100">
<template slot-scope="scope">
<el-tag :type="scope.row.erpProductStatus === 'active' ? 'success' : 'info'">
{{ scope.row.erpProductStatus === 'active' ? '正常' : '其他' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="商品链接" prop="erpProductUrl" min-width="200">
<template slot-scope="scope">
<el-link :href="scope.row.erpProductUrl" target="_blank" type="primary">
查看商品
</el-link>
</template>
</el-table-column>
<el-table-column label="备注" prop="remark" width="120" />
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="erpDialogVisible = false"> </el-button>
</div>
</el-dialog>
<!-- 快速发品对话框 -->
<el-dialog title="快速发品" :visible.sync="quickPublishVisible" width="600px" append-to-body>
<el-form ref="quickPublishForm" :model="quickPublishForm" :rules="quickPublishRules" label-width="100px">
<el-form-item label="ERP应用" prop="appid">
<el-select v-model="quickPublishForm.appid" placeholder="请选择ERP应用" style="width: 100%">
<el-option
v-for="app in erpApps"
:key="app.value"
:label="app.label"
:value="app.value"
/>
</el-select>
</el-form-item>
<el-form-item label="商品信息">
<div style="padding: 10px; background: #f5f5f5; border-radius: 4px;">
<div><strong>商品名称</strong>{{ selectedProduct.productName }}</div>
<div><strong>店铺名称</strong>{{ selectedProduct.shopName }}</div>
<div><strong>商品价格</strong>¥{{ selectedProduct.price }}</div>
</div>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="quickPublishVisible = false"> </el-button>
<el-button type="primary" @click="submitQuickPublish" :loading="quickPublishLoading"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listFavoriteProduct, getFavoriteProduct, delFavoriteProduct, addFavoriteProduct, updateFavoriteProduct, updateTopStatus, quickPublishFromFavorite } from "@/api/system/favoriteProduct";
export default {
name: "FavoriteProduct",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 常用商品表格数据
favoriteProductList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
productName: null,
shopName: null,
skuid: null,
isTop: null
},
// 表单参数
form: {},
// 表单校验
rules: {
skuid: [
{ required: true, message: "SKUID不能为空", trigger: "blur" }
],
productName: [
{ required: true, message: "商品名称不能为空", trigger: "blur" }
],
shopName: [
{ required: true, message: "店铺名称不能为空", trigger: "blur" }
]
},
// ERP商品对话框
erpDialogVisible: false,
erpProducts: [],
// 快速发品对话框
quickPublishVisible: false,
quickPublishForm: {
appid: ''
},
quickPublishRules: {
appid: [
{ required: true, message: "请选择ERP应用", trigger: "change" }
]
},
selectedProduct: {},
quickPublishLoading: false,
// ERP应用列表
erpApps: [
{ label: '闲鱼', value: 'xianyu' },
{ label: '淘宝', value: 'taobao' },
{ label: '京东', value: 'jd' }
]
};
},
created() {
this.getList();
},
methods: {
/** 查询常用商品列表 */
getList() {
this.loading = true;
listFavoriteProduct(this.queryParams).then(response => {
this.favoriteProductList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
skuid: null,
productName: null,
shopName: null,
shopId: null,
productUrl: null,
productImage: null,
price: null,
commissionInfo: null,
isTop: 0,
sortWeight: 0,
remark: null,
category: null,
brand: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加常用商品";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getFavoriteProduct(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改常用商品";
});
},
/** 查看按钮操作 */
handleView(row) {
this.reset();
const id = row.id || this.ids
getFavoriteProduct(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "查看常用商品";
// 设置为只读
this.$nextTick(() => {
Object.keys(this.form).forEach(key => {
const input = this.$refs.form.$el.querySelector(`[name="${key}"]`);
if (input) {
input.disabled = true;
}
});
});
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateFavoriteProduct(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addFavoriteProduct(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除常用商品编号为"' + ids + '"的数据项?').then(function() {
return delFavoriteProduct(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 置顶按钮操作 */
handleTop(row) {
const isTop = row.isTop === 1 ? 0 : 1;
const action = isTop === 1 ? '置顶' : '取消置顶';
this.$modal.confirm('是否确认' + action + '商品"' + row.productName + '"').then(function() {
return updateTopStatus(row.id, isTop);
}).then(() => {
this.getList();
this.$modal.msgSuccess(action + "成功");
}).catch(() => {});
},
/** 批量置顶操作 */
handleBatchTop() {
this.$modal.confirm('是否确认批量置顶选中的商品?').then(function() {
// 这里需要调用批量置顶接口
return Promise.resolve();
}).then(() => {
this.getList();
this.$modal.msgSuccess("批量置顶成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('jarvis/favoriteProduct/export', {
...this.queryParams
}, `favoriteProduct_${new Date().getTime()}.xlsx`)
},
/** 显示ERP商品详情 */
showErpProducts(row) {
try {
this.erpProducts = JSON.parse(row.erpProductIds || '[]');
this.erpDialogVisible = true;
} catch (e) {
this.$modal.msgError("ERP商品数据格式错误");
}
},
/** 快速发品 */
handleQuickPublish(row) {
this.selectedProduct = row;
this.quickPublishForm.appid = '';
this.quickPublishVisible = true;
},
/** 提交快速发品 */
submitQuickPublish() {
this.$refs["quickPublishForm"].validate(valid => {
if (valid) {
this.quickPublishLoading = true;
quickPublishFromFavorite(this.selectedProduct.id, this.quickPublishForm.appid).then(response => {
this.$modal.msgSuccess("发品请求已提交");
this.quickPublishVisible = false;
this.quickPublishLoading = false;
}).catch(() => {
this.quickPublishLoading = false;
});
}
});
}
}
};
</script>
<style scoped>
.mb8 {
margin-bottom: 8px;
}
.el-table .el-table__row:hover {
background-color: #f5f7fa;
}
.el-tag {
margin-right: 5px;
}
</style>

File diff suppressed because it is too large Load Diff