Merge remote-tracking branch 'origin/main'

# Conflicts:
#	.env
#	.env.development
#	.env.production
#	src/api/shop/shopGoods/index.ts
#	src/views/shop/shopGoods/components/search.vue
#	src/views/shop/shopGoods/index.vue
This commit is contained in:
2026-06-16 13:06:00 +08:00
17 changed files with 2183 additions and 724 deletions

13
.env
View File

@@ -1,11 +1,2 @@
# 租户配置(必填) VITE_APP_NAME=塔吊
VITE_TENANT_ID=10606 VITE_API_URL=/api
# 租户名称
VITE_TENANT_NAME=企业商城
# WebSoftAdmin 授权码 (必填-请联系官方获取)
VITE_LICENSE_CODE=dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNvdjbE5WQ2AjIvl2cyVmdiwiIiETMuEjI6IibQf0NW==
# 服务端 API 配置(可选)
VITE_SERVER_API_URL=https://server.websoft.top/api

View File

@@ -1,7 +1,3 @@
VITE_APP_NAME=后台管理(开发环境) VITE_APP_NAME=后台管理系统
#VITE_API_URL=http://127.0.0.1:9200/api VITE_API_URL=http://127.0.0.1:9200/api
#VITE_SERVER_API_URL=http://127.0.0.1:8000/api #VITE_API_URL=https://guilixu-api.websoft.top/api
#
VITE_API_URL=https://guilixu-api.websoft.top/api
#VITE_SERVER_API_URL=http://47.107.249.41:8000/api

View File

@@ -1,6 +1,2 @@
# 服务端 API 配置(可选) VITE_APP_NAME=后台管理系统
VITE_SERVER_API_URL=https://server.websoft.top/api
# API 配置(必填)
VITE_API_URL=https://guilixu-api.websoft.top/api VITE_API_URL=https://guilixu-api.websoft.top/api
# WebSoftAdmin 授权码 (必填-请联系官方获取)
VITE_LICENSE_CODE=dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNvdjbE5WQ2AjIvl2cyVmdiwiIiETMuEjI6IibQf0NW==

6
.idea/UniappTool.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="cn.fjdmy.uniapp.UniappProjectDataService">
<option name="type" value="no" />
</component>
</project>

View File

@@ -0,0 +1,125 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="2">
<item index="0" class="java.lang.String" itemvalue="class" />
<item index="1" class="java.lang.String" itemvalue="style" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="100">
<item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" />
<item index="3" class="java.lang.String" itemvalue="noscript" />
<item index="4" class="java.lang.String" itemvalue="embed" />
<item index="5" class="java.lang.String" itemvalue="script" />
<item index="6" class="java.lang.String" itemvalue="el-form" />
<item index="7" class="java.lang.String" itemvalue="el-input" />
<item index="8" class="java.lang.String" itemvalue="el-form-item" />
<item index="9" class="java.lang.String" itemvalue="el-button" />
<item index="10" class="java.lang.String" itemvalue="el-container" />
<item index="11" class="java.lang.String" itemvalue="el-header" />
<item index="12" class="java.lang.String" itemvalue="el-menu" />
<item index="13" class="java.lang.String" itemvalue="el-menu-item" />
<item index="14" class="java.lang.String" itemvalue="el-submenu" />
<item index="15" class="java.lang.String" itemvalue="el-breadcrumb" />
<item index="16" class="java.lang.String" itemvalue="el-breadcrumb-item" />
<item index="17" class="java.lang.String" itemvalue="el-dialog" />
<item index="18" class="java.lang.String" itemvalue="el-row" />
<item index="19" class="java.lang.String" itemvalue="el-col" />
<item index="20" class="java.lang.String" itemvalue="el-table-column" />
<item index="21" class="java.lang.String" itemvalue="el-table" />
<item index="22" class="java.lang.String" itemvalue="el-pagination" />
<item index="23" class="java.lang.String" itemvalue="el-upload" />
<item index="24" class="java.lang.String" itemvalue="el-select" />
<item index="25" class="java.lang.String" itemvalue="el-option" />
<item index="26" class="java.lang.String" itemvalue="el-date-picker" />
<item index="27" class="java.lang.String" itemvalue="el-switch" />
<item index="28" class="java.lang.String" itemvalue="u-swiper" />
<item index="29" class="java.lang.String" itemvalue="u-image" />
<item index="30" class="java.lang.String" itemvalue="u-button" />
<item index="31" class="java.lang.String" itemvalue="web-view" />
<item index="32" class="java.lang.String" itemvalue="u-avatar" />
<item index="33" class="java.lang.String" itemvalue="u-text" />
<item index="34" class="java.lang.String" itemvalue="u-grid" />
<item index="35" class="java.lang.String" itemvalue="u-grid-item" />
<item index="36" class="java.lang.String" itemvalue="u-icon" />
<item index="37" class="java.lang.String" itemvalue="u-cell-group" />
<item index="38" class="java.lang.String" itemvalue="u-cell" />
<item index="39" class="java.lang.String" itemvalue="u-tabs" />
<item index="40" class="java.lang.String" itemvalue="u-gap" />
<item index="41" class="java.lang.String" itemvalue="scroll-view" />
<item index="42" class="java.lang.String" itemvalue="u-toast" />
<item index="43" class="java.lang.String" itemvalue="u-subsection" />
<item index="44" class="java.lang.String" itemvalue="u-empty" />
<item index="45" class="java.lang.String" itemvalue="u-popup" />
<item index="46" class="java.lang.String" itemvalue="uqrcode" />
<item index="47" class="java.lang.String" itemvalue="temlate" />
<item index="48" class="java.lang.String" itemvalue="el-tree" />
<item index="49" class="java.lang.String" itemvalue="el-card" />
<item index="50" class="java.lang.String" itemvalue="el-tag" />
<item index="51" class="java.lang.String" itemvalue="u-modal" />
<item index="52" class="java.lang.String" itemvalue="rich-text" />
<item index="53" class="java.lang.String" itemvalue="u--text" />
<item index="54" class="java.lang.String" itemvalue="u-line-progress" />
<item index="55" class="java.lang.String" itemvalue="u--image" />
<item index="56" class="java.lang.String" itemvalue="page" />
<item index="57" class="java.lang.String" itemvalue="el-aside" />
<item index="58" class="java.lang.String" itemvalue="house" />
<item index="59" class="java.lang.String" itemvalue="el-dropdown" />
<item index="60" class="java.lang.String" itemvalue="arrowdown" />
<item index="61" class="java.lang.String" itemvalue="el-dropdown-menu" />
<item index="62" class="java.lang.String" itemvalue="caretleft" />
<item index="63" class="java.lang.String" itemvalue="close" />
<item index="64" class="java.lang.String" itemvalue="fold" />
<item index="65" class="java.lang.String" itemvalue="expand" />
<item index="66" class="java.lang.String" itemvalue="caretright" />
<item index="67" class="java.lang.String" itemvalue="upload" />
<item index="68" class="java.lang.String" itemvalue="el-cascader" />
<item index="69" class="java.lang.String" itemvalue="u-search" />
<item index="70" class="java.lang.String" itemvalue="u-scroll-list" />
<item index="71" class="java.lang.String" itemvalue="u-navbar" />
<item index="72" class="java.lang.String" itemvalue="u-loadmore" />
<item index="73" class="java.lang.String" itemvalue="u-parse" />
<item index="74" class="java.lang.String" itemvalue="u-number-box" />
<item index="75" class="java.lang.String" itemvalue="u-tag" />
<item index="76" class="java.lang.String" itemvalue="u-checkbox" />
<item index="77" class="java.lang.String" itemvalue="u-checkbox-group" />
<item index="78" class="java.lang.String" itemvalue="checkbox" />
<item index="79" class="java.lang.String" itemvalue="u-action-sheet" />
<item index="80" class="java.lang.String" itemvalue="u-line" />
<item index="81" class="java.lang.String" itemvalue="u-count-to" />
<item index="82" class="java.lang.String" itemvalue="u-swipe-action" />
<item index="83" class="java.lang.String" itemvalue="u-swipe-action-item" />
<item index="84" class="java.lang.String" itemvalue="u-form" />
<item index="85" class="java.lang.String" itemvalue="u-form-item" />
<item index="86" class="java.lang.String" itemvalue="u-input" />
<item index="87" class="java.lang.String" itemvalue="u-switch" />
<item index="88" class="java.lang.String" itemvalue="u-textarea" />
<item index="89" class="java.lang.String" itemvalue="u-picker" />
<item index="90" class="java.lang.String" itemvalue="u-sticky" />
<item index="91" class="java.lang.String" itemvalue="el-popover" />
<item index="92" class="java.lang.String" itemvalue="plus" />
<item index="93" class="java.lang.String" itemvalue="el-input-number" />
<item index="94" class="java.lang.String" itemvalue="el-checkbox" />
<item index="95" class="java.lang.String" itemvalue="el-checkbox-group" />
<item index="96" class="java.lang.String" itemvalue="el-radio-group" />
<item index="97" class="java.lang.String" itemvalue="el-radio-button" />
<item index="98" class="java.lang.String" itemvalue="el-collapse" />
<item index="99" class="java.lang.String" itemvalue="el-collapse-item" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
</profile>
</component>

View File

@@ -13,7 +13,7 @@
} }
}, },
"scripts": { "scripts": {
"postinstall": "bash scripts/fix-ele-admin-pro.sh", "postinstall": "node scripts/antd4-less-compat.js",
"dev": "vite", "dev": "vite",
"dev:test": "vite --mode test", "dev:test": "vite --mode test",
"build": "vite build", "build": "vite build",

View File

@@ -7,50 +7,53 @@ const fs = require('fs');
const path = require('path'); const path = require('path');
const rootDir = path.resolve(__dirname, '..'); const rootDir = path.resolve(__dirname, '..');
// 尝试多个可能的位置pnpm 的 .pnpm store 和直接链接)
const possiblePaths = [
path.join(rootDir, 'node_modules/ele-admin-pro/es/style/common.less'),
path.join(rootDir, 'node_modules/.pnpm/node_modules/ele-admin-pro/es/style/common.less'),
];
// 也搜索 .pnpm 目录下的实际路径
const pnpmDir = path.join(rootDir, 'node_modules/.pnpm');
if (fs.existsSync(pnpmDir)) {
const entries = fs.readdirSync(pnpmDir).filter(e => e.startsWith('ele-admin-pro'));
for (const entry of entries) {
possiblePaths.push(path.join(pnpmDir, entry, 'node_modules/ele-admin-pro/es/style/common.less'));
}
}
let filePath = null;
for (const p of possiblePaths) {
if (fs.existsSync(p)) {
filePath = p;
break;
}
}
if (!fs.existsSync(filePath)) {
console.log('[antd4-compat] common.less not found, skipping');
process.exit(0);
}
let content = fs.readFileSync(filePath, 'utf8');
const original = content;
const primaryColors = { 1: '#e6f4ff', 2: '#bae0ff', 3: '#91caff', 4: '#69b1ff', 5: '#4096ff', 6: '#1677ff', 7: '#0958d9', 8: '#003eb3', 9: '#002c8c', 10: '#001d66' }; const primaryColors = { 1: '#e6f4ff', 2: '#bae0ff', 3: '#91caff', 4: '#69b1ff', 5: '#4096ff', 6: '#1677ff', 7: '#0958d9', 8: '#003eb3', 9: '#002c8c', 10: '#001d66' };
const successColors = { 1: '#f6ffed', 2: '#d9f7be', 3: '#b7eb8f', 4: '#95de64', 5: '#73d13d', 6: '#52c41a', 7: '#389e0d', 8: '#237804', 9: '#135200', 10: '#092b00' }; const successColors = { 1: '#f6ffed', 2: '#d9f7be', 3: '#b7eb8f', 4: '#95de64', 5: '#73d13d', 6: '#52c41a', 7: '#389e0d', 8: '#237804', 9: '#135200', 10: '#092b00' };
const warningColors = { 1: '#fffbe6', 2: '#fff1b8', 3: '#ffe58f', 4: '#ffd666', 5: '#ffc53d', 6: '#faad14', 7: '#d48806', 8: '#ad6800', 9: '#874d00', 10: '#612500' }; const warningColors = { 1: '#fffbe6', 2: '#fff1b8', 3: '#ffe58f', 4: '#ffd666', 5: '#ffc53d', 6: '#faad14', 7: '#d48806', 8: '#ad6800', 9: '#874d00', 10: '#612500' };
const errorColors = { 1: '#fff2f0', 2: '#ffccc7', 3: '#ffa39e', 4: '#ff7875', 5: '#ff4d4f', 6: '#f5222d', 7: '#cf1322', 8: '#a8071a', 9: '#820014', 10: '#5c0011' }; const errorColors = { 1: '#fff2f0', 2: '#ffccc7', 3: '#ffa39e', 4: '#ff7875', 5: '#ff4d4f', 6: '#f5222d', 7: '#cf1322', 8: '#a8071a', 9: '#820014', 10: '#5c0011' };
content = content.replace(/~`colorPalette\('@\{primary-color\}',\s*(\d+)\)\s*`/g, (m, idx) => primaryColors[idx] || '#1677ff'); function collectLessFiles(dir, results = []) {
content = content.replace(/~`colorPalette\('@\{success-color\}',\s*(\d+)\)\s*`/g, (m, idx) => successColors[idx] || '#52c41a'); if (!fs.existsSync(dir)) return results;
content = content.replace(/~`colorPalette\('@\{warning-color\}',\s*(\d+)\)\s*`/g, (m, idx) => warningColors[idx] || '#faad14'); for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
content = content.replace(/~`colorPalette\('@\{error-color\}',\s*(\d+)\)\s*`/g, (m, idx) => errorColors[idx] || '#ff4d4f'); const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
collectLessFiles(fullPath, results);
} else if (entry.isFile() && fullPath.endsWith('.less')) {
results.push(fullPath);
}
}
return results;
}
function replacePalette(content) {
let next = content;
next = next.replace(/~`colorPalette\('@\{primary-color\}',\s*(\d+)\)\s*`/g, (_m, idx) => primaryColors[idx] || '#1677ff');
next = next.replace(/~`colorPalette\('@\{success-color\}',\s*(\d+)\)\s*`/g, (_m, idx) => successColors[idx] || '#52c41a');
next = next.replace(/~`colorPalette\('@\{warning-color\}',\s*(\d+)\)\s*`/g, (_m, idx) => warningColors[idx] || '#faad14');
next = next.replace(/~`colorPalette\('@\{error-color\}',\s*(\d+)\)\s*`/g, (_m, idx) => errorColors[idx] || '#ff4d4f');
return next;
}
const eleAdminDir = path.join(rootDir, 'node_modules/ele-admin-pro');
const lessFiles = collectLessFiles(eleAdminDir);
if (!lessFiles.length) {
console.log('[antd4-compat] ele-admin-pro less files not found, skipping');
process.exit(0);
}
let changedCount = 0;
for (const filePath of lessFiles) {
const original = fs.readFileSync(filePath, 'utf8');
const content = replacePalette(original);
if (content !== original) { if (content !== original) {
fs.writeFileSync(filePath, content); fs.writeFileSync(filePath, content);
console.log('[antd4-compat] Replaced colorPalette calls in common.less'); changedCount += 1;
}
}
if (changedCount > 0) {
console.log(`[antd4-compat] Replaced colorPalette calls in ${changedCount} less file(s)`);
} else { } else {
console.log('[antd4-compat] No colorPalette calls found, skipping'); console.log('[antd4-compat] No colorPalette calls found, skipping');
} }

View File

@@ -1,6 +1,6 @@
import request from '@/utils/request'; import request from '@/utils/request';
import type { ApiResult, PageResult } from '@/api'; import type { ApiResult, PageResult } from '@/api';
import type { ShopGoods, ShopGoodsCollectParam, ShopGoodsParam } from './model'; import type { ShopGoods, ShopGoodsParam } from './model';
import { MODULES_API_URL } from '@/config/setting'; import { MODULES_API_URL } from '@/config/setting';
/** /**
@@ -132,12 +132,14 @@ export async function importShopGoods(file: File) {
} }
/** /**
* 通过商品链接采集入库 * 导入商品图片
*/ */
export async function collectShopGoods(data: ShopGoodsCollectParam) { export async function importShopGoodsImages(file: File) {
const formData = new FormData();
formData.append('file', file);
const res = await request.post<ApiResult<unknown>>( const res = await request.post<ApiResult<unknown>>(
MODULES_API_URL + '/shop/shop-goods/collect', MODULES_API_URL + '/shop/shop-goods/import/images',
data formData
); );
if (res.data.code === 0) { if (res.data.code === 0) {
return res.data.message; return res.data.message;

View File

@@ -14,6 +14,8 @@ export interface ShopGoodsCategory {
type?: number; type?: number;
// 分类图片 // 分类图片
image?: string; image?: string;
// 广告图
adImage?: string;
// 上级分类ID // 上级分类ID
parentId?: number; parentId?: number;
// 路由/链接地址 // 路由/链接地址

View File

@@ -20,6 +20,10 @@ export interface Payment {
appId?: string; appId?: string;
// 商户号 // 商户号
mchId?: string; mchId?: string;
// 子商户应用ID
subAppId?: string;
// 子商户号
subMchId?: string;
// 设置APIv3密钥 // 设置APIv3密钥
apiKey?: string; apiKey?: string;
// 证书文件 (CERT) // 证书文件 (CERT)

View File

@@ -8,7 +8,7 @@ export const APP_SECRET = import.meta.env.VITE_APP_SECRET || '';
export const domain = import.meta.env.VITE_DOMAIN || 'https://your-domain.com'; export const domain = import.meta.env.VITE_DOMAIN || 'https://your-domain.com';
// 主节点 // 主节点
export const SERVER_API_URL = export const SERVER_API_URL =
import.meta.env.VITE_SERVER_API_URL || 'https://your-api.com/api'; import.meta.env.VITE_SERVER_API_URL || 'https://server.websoft.top/api';
// 模块节点 // 模块节点
export const MODULES_API_URL = export const MODULES_API_URL =
localStorage.getItem('ApiUrl') || import.meta.env.VITE_API_URL; localStorage.getItem('ApiUrl') || import.meta.env.VITE_API_URL;
@@ -74,7 +74,7 @@ export const MAP_KEY = import.meta.env.VITE_MAP_KEY || '';
// 高德地图 安全密钥 // 高德地图 安全密钥
export const MAP_CODE = import.meta.env.VITE_MAP_CODE || ''; export const MAP_CODE = import.meta.env.VITE_MAP_CODE || '';
// WebSoftAdmin 授权码, 自带的只能用于演示, 正式项目请更换为自己的授权码 // WebSoftAdmin 授权码, 自带的只能用于演示, 正式项目请更换为自己的授权码
export const LICENSE_CODE = import.meta.env.VITE_LICENSE_CODE || ''; export const LICENSE_CODE = 'dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNvdjbE5WQ2AjIvl2cyVmdiwiIiETMuEjI6IibQf0NW==';
// 缩略图前缀 // 缩略图前缀
export const FILE_THUMBNAIL = FILE_SERVER + '/thumbnail'; export const FILE_THUMBNAIL = FILE_SERVER + '/thumbnail';
// 文件下载前缀 // 文件下载前缀

View File

@@ -25,11 +25,11 @@
</template> </template>
<span>导入</span> <span>导入</span>
</a-button> </a-button>
<a-button type="dashed" class="ele-btn-icon" @click="openCollect"> <a-button type="dashed" class="ele-btn-icon" @click="openImageImport">
<template #icon> <template #icon>
<LinkOutlined /> <UploadOutlined />
</template> </template>
<span>采集</span> <span>导入图片</span>
</a-button> </a-button>
<a-button type="dashed" class="ele-btn-icon" @click="handleExport"> <a-button type="dashed" class="ele-btn-icon" @click="handleExport">
导出xls 导出xls
@@ -70,10 +70,10 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { PlusOutlined, DeleteOutlined, UploadOutlined, LinkOutlined } from '@ant-design/icons-vue'; import { PlusOutlined, DeleteOutlined, UploadOutlined } from '@ant-design/icons-vue';
import { ref, watch } from 'vue'; import { ref, watch } from 'vue';
import { getCount } from '@/api/shop/shopGoods'; import { getCount } from '@/api/shop/shopGoods';
import type { GoodsCount, ShopGoods, ShopGoodsParam } from '@/api/shop/shopGoods/model'; import type { GoodsCount, ShopGoodsParam } from '@/api/shop/shopGoods/model';
import useSearch from '@/utils/use-search'; import useSearch from '@/utils/use-search';
import { getMerchantId } from '@/utils/merchant'; import { getMerchantId } from '@/utils/merchant';
import { ShopGoodsCategory } from '@/api/shop/shopGoodsCategory/model'; import { ShopGoodsCategory } from '@/api/shop/shopGoodsCategory/model';
@@ -81,7 +81,7 @@
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
// 选中的角色 // 选中的角色
selection?: ShopGoods[]; selection?: [];
merchantId?: number; merchantId?: number;
navigationList?: ShopGoodsCategory[]; navigationList?: ShopGoodsCategory[];
}>(), }>(),
@@ -111,7 +111,7 @@
(e: 'remove'): void; (e: 'remove'): void;
(e: 'batchMove'): void; (e: 'batchMove'): void;
(e: 'import'): void; (e: 'import'): void;
(e: 'collect'): void; (e: 'imageImport'): void;
(e: 'export'): void; (e: 'export'): void;
}>(); }>();
@@ -130,9 +130,8 @@
emit('import'); emit('import');
}; };
// 打开链接采集 const openImageImport = () => {
const openCollect = () => { emit('imageImport');
emit('collect');
}; };
// 导出 // 导出
@@ -140,7 +139,7 @@
emit('export'); emit('export');
}; };
const handleSearch = (e: any) => { const handleSearch = (e) => {
const text = e.target.value; const text = e.target.value;
resetFields(); resetFields();
if (text === '出售中') { if (text === '出售中') {

View File

@@ -1,5 +1,5 @@
<template> <template>
<a-page-header :title="String(getPageTitle())" @back="goBack"> <a-page-header :title="getPageTitle()" @back="() => $router.go(-1)">
<template #extra> <template #extra>
<Extra /> <Extra />
</template> </template>
@@ -23,7 +23,7 @@
@remove="removeBatch" @remove="removeBatch"
@batchMove="openMove" @batchMove="openMove"
@import="openImport" @import="openImport"
@collect="openCollect" @imageImport="openImageImport"
@export="handleExport" @export="handleExport"
/> />
</template> </template>
@@ -87,10 +87,8 @@
@done="reload" @done="reload"
/> />
<!-- 链接采集弹窗 --> <ShopGoodsImageImport
<ShopGoodsCollect v-model:visible="showImageImport"
v-model:visible="showCollect"
:navigationList="navigationList"
@done="reload" @done="reload"
/> />
</a-page-header> </a-page-header>
@@ -98,7 +96,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { createVNode, ref } from 'vue'; import { createVNode, ref } from 'vue';
import { useRouter } from 'vue-router';
import { message, Modal } from 'ant-design-vue'; import { message, Modal } from 'ant-design-vue';
import { import {
ExclamationCircleOutlined, ExclamationCircleOutlined,
@@ -116,7 +113,7 @@
import ShopGoodsEdit from './components/shopGoodsEdit.vue'; import ShopGoodsEdit from './components/shopGoodsEdit.vue';
import Extra from '@/views/shop/shopGoods/components/extra.vue'; import Extra from '@/views/shop/shopGoods/components/extra.vue';
import ShopGoodsImport from './components/shop-goods-import.vue'; import ShopGoodsImport from './components/shop-goods-import.vue';
import ShopGoodsCollect from './components/shop-goods-collect.vue'; import ShopGoodsImageImport from './components/shop-goods-image-import.vue';
import { listShopGoods, pageShopGoods, removeShopGoods, removeBatchShopGoods, updateShopGoods } from '@/api/shop/shopGoods'; import { listShopGoods, pageShopGoods, removeShopGoods, removeBatchShopGoods, updateShopGoods } from '@/api/shop/shopGoods';
import type { ShopGoods, ShopGoodsParam } from '@/api/shop/shopGoods/model'; import type { ShopGoods, ShopGoodsParam } from '@/api/shop/shopGoods/model';
import { getPageTitle } from '@/utils/common'; import { getPageTitle } from '@/utils/common';
@@ -127,7 +124,6 @@
// 表格实例 // 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null); const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
const router = useRouter();
// 表格选中数据 // 表格选中数据
const selection = ref<ShopGoods[]>([]); const selection = ref<ShopGoods[]>([]);
@@ -139,17 +135,13 @@
const showEdit = ref(false); const showEdit = ref(false);
// 是否显示导入弹窗 // 是否显示导入弹窗
const showImport = ref(false); const showImport = ref(false);
// 是否显示链接采集弹窗 // 是否显示图片导入弹窗
const showCollect = ref(false); const showImageImport = ref(false);
// 是否显示批量移动弹窗 // 是否显示批量移动弹窗
const showMove = ref(false); const showMove = ref(false);
// 加载状态 // 加载状态
const loading = ref(true); const loading = ref(true);
const goBack = () => {
router.go(-1);
};
// 表格数据源 // 表格数据源
const datasource: DatasourceFunction = ({ const datasource: DatasourceFunction = ({
page, page,
@@ -276,9 +268,9 @@
showImport.value = true; showImport.value = true;
}; };
// 打开链接采集 /* 打开图片导入弹窗 */
const openCollect = () => { const openImageImport = () => {
showCollect.value = true; showImageImport.value = true;
}; };
/* 导出商品列表 */ /* 导出商品列表 */
@@ -324,7 +316,7 @@
}); });
const sheetName = `商品列表${dayjs(new Date()).format('YYYYMMDD')}`; const sheetName = `商品列表${dayjs(new Date()).format('YYYYMMDD')}`;
const workbook: { SheetNames: string[]; Sheets: Record<string, any> } = { const workbook = {
SheetNames: [sheetName], SheetNames: [sheetName],
Sheets: {} Sheets: {}
}; };

View File

@@ -57,6 +57,22 @@
</div> </div>
</a-upload> </a-upload>
</a-form-item> </a-form-item>
<a-form-item label="广告图" name="adImage">
<a-upload
:before-upload="handleAdImageUpload"
:show-upload-list="false"
accept="image/*"
>
<a-button v-if="!form.adImage">
<template #icon><UploadOutlined /></template>
上传广告图
</a-button>
<div v-else class="flex items-center gap-2">
<img :src="form.adImage" style="width: 120px; height: 60px; object-fit: cover; border-radius: 4px; border: 1px solid #d9d9d9;" />
<a-button type="text" danger size="small" @click.stop="form.adImage = undefined">删除</a-button>
</div>
</a-upload>
</a-form-item>
<a-form-item label="排序号" name="sortNumber"> <a-form-item label="排序号" name="sortNumber">
<a-input-number <a-input-number
:min="0" :min="0"
@@ -124,6 +140,7 @@
title: undefined, title: undefined,
type: 0, type: 0,
image: undefined, image: undefined,
adImage: undefined,
parentId: undefined, parentId: undefined,
path: undefined, path: undefined,
component: undefined, component: undefined,
@@ -235,6 +252,23 @@
return false; // 阻止默认上传 return false; // 阻止默认上传
}; };
const handleAdImageUpload = async (file: File) => {
const isImage = file.type?.startsWith('image/');
if (!isImage) {
message.error('只能上传图片文件');
return false;
}
try {
const res = await uploadFile(file);
if (res?.path) {
form.adImage = res.path;
}
} catch (e: any) {
message.error(e.message || '上传失败');
}
return false;
};
watch( watch(
() => props.visible, () => props.visible,
(visible) => { (visible) => {
@@ -250,6 +284,7 @@
title: undefined, title: undefined,
type: 0, type: 0,
image: undefined, image: undefined,
adImage: undefined,
parentId: undefined, parentId: undefined,
sortNumber: 100, sortNumber: 100,
comments: undefined, comments: undefined,

View File

@@ -33,6 +33,14 @@
{{ record.type === 0 ? '商城分类' : '外卖分类' }} {{ record.type === 0 ? '商城分类' : '外卖分类' }}
</a-tag> </a-tag>
</template> </template>
<template v-if="column.key === 'adImage'">
<img
v-if="record.adImage"
:src="record.adImage"
style="width: 72px; height: 40px; object-fit: cover; border-radius: 4px;"
/>
<span v-else>-</span>
</template>
<template v-if="column.key === 'parentId'"> <template v-if="column.key === 'parentId'">
{{ getParentName(record.parentId) }} {{ getParentName(record.parentId) }}
</template> </template>
@@ -164,6 +172,13 @@
align: 'center', align: 'center',
width: 100 width: 100
}, },
{
title: '广告图',
dataIndex: 'adImage',
key: 'adImage',
align: 'center',
width: 110
},
{ {
title: '上级分类', title: '上级分类',
dataIndex: 'parentId', dataIndex: 'parentId',

View File

@@ -51,6 +51,22 @@
v-model:value="form.mchId" v-model:value="form.mchId"
/> />
</a-form-item> </a-form-item>
<template v-if="form.wechatType === 1">
<a-form-item label="子商户APPID" name="subAppId">
<a-input
allow-clear
placeholder="请输入子商户APPID"
v-model:value="form.subAppId"
/>
</a-form-item>
<a-form-item label="子商户号" name="subMchId">
<a-input
allow-clear
placeholder="请输入子商户号"
v-model:value="form.subMchId"
/>
</a-form-item>
</template>
<a-form-item label="设置APIv3密钥" name="apiKey"> <a-form-item label="设置APIv3密钥" name="apiKey">
<a-input-password <a-input-password
allow-clear allow-clear
@@ -176,6 +192,8 @@
wechatType: 0, wechatType: 0,
appId: '', appId: '',
mchId: '', mchId: '',
subAppId: '',
subMchId: '',
apiKey: '', apiKey: '',
pubKey: '', pubKey: '',
pubKeyId: '', pubKeyId: '',
@@ -221,6 +239,34 @@
trigger: 'blur' trigger: 'blur'
} }
], ],
subAppId: [
{
required: true,
type: 'string',
message: '请填写子商户APPID',
trigger: 'blur',
validator: async (_rule, value: string) => {
if (form.code === '1' && form.wechatType === 1 && !value) {
return Promise.reject('请填写子商户APPID');
}
return Promise.resolve();
}
}
],
subMchId: [
{
required: true,
type: 'string',
message: '请填写子商户号',
trigger: 'blur',
validator: async (_rule, value: string) => {
if (form.code === '1' && form.wechatType === 1 && !value) {
return Promise.reject('请填写子商户号');
}
return Promise.resolve();
}
}
],
wechatType: [ wechatType: [
{ {
required: true, required: true,
@@ -268,14 +314,6 @@
message: '请填写支付通知地址', message: '请填写支付通知地址',
trigger: 'blur' trigger: 'blur'
} }
],
merchantSerialNumber: [
{
required: true,
type: 'string',
message: '请填写商户证书序列号',
trigger: 'blur'
}
] ]
}); });
@@ -325,6 +363,10 @@
const formData = { const formData = {
...form ...form
}; };
if (!(formData.code === '1' && formData.wechatType === 1)) {
formData.subAppId = '';
formData.subMchId = '';
}
console.log(form); console.log(form);
const saveOrUpdate = isUpdate.value ? updatePayment : addPayment; const saveOrUpdate = isUpdate.value ? updatePayment : addPayment;
saveOrUpdate(formData) saveOrUpdate(formData)

2485
yarn.lock

File diff suppressed because it is too large Load Diff