260616
This commit is contained in:
3
.env.development
Normal file
3
.env.development
Normal file
@@ -0,0 +1,3 @@
|
||||
VITE_APP_NAME=后台管理系统
|
||||
VITE_API_URL=http://127.0.0.1:9200/api
|
||||
#VITE_API_URL=https://guilixu-api.websoft.top/api
|
||||
2
.env.production
Normal file
2
.env.production
Normal file
@@ -0,0 +1,2 @@
|
||||
VITE_APP_NAME=后台管理系统
|
||||
VITE_API_URL=https://guilixu-api.websoft.top/api
|
||||
6
.idea/UniappTool.xml
generated
Normal file
6
.idea/UniappTool.xml
generated
Normal 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>
|
||||
125
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
125
.idea/inspectionProfiles/Project_Default.xml
generated
Normal 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>
|
||||
@@ -13,7 +13,7 @@
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "bash scripts/fix-ele-admin-pro.sh",
|
||||
"postinstall": "node scripts/antd4-less-compat.js",
|
||||
"dev": "vite",
|
||||
"dev:test": "vite --mode test",
|
||||
"build": "vite build",
|
||||
|
||||
@@ -7,50 +7,53 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
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 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 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');
|
||||
content = content.replace(/~`colorPalette\('@\{success-color\}',\s*(\d+)\)\s*`/g, (m, idx) => successColors[idx] || '#52c41a');
|
||||
content = content.replace(/~`colorPalette\('@\{warning-color\}',\s*(\d+)\)\s*`/g, (m, idx) => warningColors[idx] || '#faad14');
|
||||
content = content.replace(/~`colorPalette\('@\{error-color\}',\s*(\d+)\)\s*`/g, (m, idx) => errorColors[idx] || '#ff4d4f');
|
||||
function collectLessFiles(dir, results = []) {
|
||||
if (!fs.existsSync(dir)) return results;
|
||||
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
||||
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;
|
||||
}
|
||||
|
||||
if (content !== original) {
|
||||
fs.writeFileSync(filePath, content);
|
||||
console.log('[antd4-compat] Replaced colorPalette calls in common.less');
|
||||
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) {
|
||||
fs.writeFileSync(filePath, content);
|
||||
changedCount += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (changedCount > 0) {
|
||||
console.log(`[antd4-compat] Replaced colorPalette calls in ${changedCount} less file(s)`);
|
||||
} else {
|
||||
console.log('[antd4-compat] No colorPalette calls found, skipping');
|
||||
}
|
||||
|
||||
@@ -130,3 +130,19 @@ export async function importShopGoods(file: File) {
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入商品图片
|
||||
*/
|
||||
export async function importShopGoodsImages(file: File) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/shop-goods/import/images',
|
||||
formData
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ export interface ShopGoodsCategory {
|
||||
type?: number;
|
||||
// 分类图片
|
||||
image?: string;
|
||||
// 广告图
|
||||
adImage?: string;
|
||||
// 上级分类ID
|
||||
parentId?: number;
|
||||
// 路由/链接地址
|
||||
|
||||
@@ -20,6 +20,10 @@ export interface Payment {
|
||||
appId?: string;
|
||||
// 商户号
|
||||
mchId?: string;
|
||||
// 子商户应用ID
|
||||
subAppId?: string;
|
||||
// 子商户号
|
||||
subMchId?: string;
|
||||
// 设置APIv3密钥
|
||||
apiKey?: string;
|
||||
// 证书文件 (CERT)
|
||||
|
||||
@@ -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 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 =
|
||||
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 || '';
|
||||
// WebSoftAdmin 授权码, 自带的只能用于演示, 正式项目请更换为自己的授权码
|
||||
export const LICENSE_CODE = import.meta.env.VITE_LICENSE_CODE || '';
|
||||
export const LICENSE_CODE = 'dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNvdjbE5WQ2AjIvl2cyVmdiwiIiETMuEjI6IibQf0NW==';
|
||||
// 缩略图前缀
|
||||
export const FILE_THUMBNAIL = FILE_SERVER + '/thumbnail';
|
||||
// 文件下载前缀
|
||||
|
||||
@@ -25,6 +25,12 @@
|
||||
</template>
|
||||
<span>导入</span>
|
||||
</a-button>
|
||||
<a-button type="dashed" class="ele-btn-icon" @click="openImageImport">
|
||||
<template #icon>
|
||||
<UploadOutlined />
|
||||
</template>
|
||||
<span>导入图片</span>
|
||||
</a-button>
|
||||
<a-button type="dashed" class="ele-btn-icon" @click="handleExport">
|
||||
导出xls
|
||||
</a-button>
|
||||
@@ -105,6 +111,7 @@
|
||||
(e: 'remove'): void;
|
||||
(e: 'batchMove'): void;
|
||||
(e: 'import'): void;
|
||||
(e: 'imageImport'): void;
|
||||
(e: 'export'): void;
|
||||
}>();
|
||||
|
||||
@@ -123,6 +130,10 @@
|
||||
emit('import');
|
||||
};
|
||||
|
||||
const openImageImport = () => {
|
||||
emit('imageImport');
|
||||
};
|
||||
|
||||
// 导出
|
||||
const handleExport = () => {
|
||||
emit('export');
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
@remove="removeBatch"
|
||||
@batchMove="openMove"
|
||||
@import="openImport"
|
||||
@imageImport="openImageImport"
|
||||
@export="handleExport"
|
||||
/>
|
||||
</template>
|
||||
@@ -85,6 +86,11 @@
|
||||
v-model:visible="showImport"
|
||||
@done="reload"
|
||||
/>
|
||||
|
||||
<ShopGoodsImageImport
|
||||
v-model:visible="showImageImport"
|
||||
@done="reload"
|
||||
/>
|
||||
</a-page-header>
|
||||
</template>
|
||||
|
||||
@@ -107,6 +113,7 @@
|
||||
import ShopGoodsEdit from './components/shopGoodsEdit.vue';
|
||||
import Extra from '@/views/shop/shopGoods/components/extra.vue';
|
||||
import ShopGoodsImport from './components/shop-goods-import.vue';
|
||||
import ShopGoodsImageImport from './components/shop-goods-image-import.vue';
|
||||
import { listShopGoods, pageShopGoods, removeShopGoods, removeBatchShopGoods, updateShopGoods } from '@/api/shop/shopGoods';
|
||||
import type { ShopGoods, ShopGoodsParam } from '@/api/shop/shopGoods/model';
|
||||
import { getPageTitle } from '@/utils/common';
|
||||
@@ -128,6 +135,8 @@
|
||||
const showEdit = ref(false);
|
||||
// 是否显示导入弹窗
|
||||
const showImport = ref(false);
|
||||
// 是否显示图片导入弹窗
|
||||
const showImageImport = ref(false);
|
||||
// 是否显示批量移动弹窗
|
||||
const showMove = ref(false);
|
||||
// 加载状态
|
||||
@@ -259,6 +268,11 @@
|
||||
showImport.value = true;
|
||||
};
|
||||
|
||||
/* 打开图片导入弹窗 */
|
||||
const openImageImport = () => {
|
||||
showImageImport.value = true;
|
||||
};
|
||||
|
||||
/* 导出商品列表 */
|
||||
const handleExport = async () => {
|
||||
if (loading.value) {
|
||||
|
||||
@@ -57,6 +57,22 @@
|
||||
</div>
|
||||
</a-upload>
|
||||
</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-input-number
|
||||
:min="0"
|
||||
@@ -124,6 +140,7 @@
|
||||
title: undefined,
|
||||
type: 0,
|
||||
image: undefined,
|
||||
adImage: undefined,
|
||||
parentId: undefined,
|
||||
path: undefined,
|
||||
component: undefined,
|
||||
@@ -235,6 +252,23 @@
|
||||
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(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
@@ -250,6 +284,7 @@
|
||||
title: undefined,
|
||||
type: 0,
|
||||
image: undefined,
|
||||
adImage: undefined,
|
||||
parentId: undefined,
|
||||
sortNumber: 100,
|
||||
comments: undefined,
|
||||
|
||||
@@ -33,6 +33,14 @@
|
||||
{{ record.type === 0 ? '商城分类' : '外卖分类' }}
|
||||
</a-tag>
|
||||
</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'">
|
||||
{{ getParentName(record.parentId) }}
|
||||
</template>
|
||||
@@ -164,6 +172,13 @@
|
||||
align: 'center',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
title: '广告图',
|
||||
dataIndex: 'adImage',
|
||||
key: 'adImage',
|
||||
align: 'center',
|
||||
width: 110
|
||||
},
|
||||
{
|
||||
title: '上级分类',
|
||||
dataIndex: 'parentId',
|
||||
|
||||
@@ -51,6 +51,22 @@
|
||||
v-model:value="form.mchId"
|
||||
/>
|
||||
</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-input-password
|
||||
allow-clear
|
||||
@@ -176,6 +192,8 @@
|
||||
wechatType: 0,
|
||||
appId: '',
|
||||
mchId: '',
|
||||
subAppId: '',
|
||||
subMchId: '',
|
||||
apiKey: '',
|
||||
pubKey: '',
|
||||
pubKeyId: '',
|
||||
@@ -221,6 +239,34 @@
|
||||
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: [
|
||||
{
|
||||
required: true,
|
||||
@@ -268,14 +314,6 @@
|
||||
message: '请填写支付通知地址',
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
merchantSerialNumber: [
|
||||
{
|
||||
required: true,
|
||||
type: 'string',
|
||||
message: '请填写商户证书序列号',
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@@ -325,6 +363,10 @@
|
||||
const formData = {
|
||||
...form
|
||||
};
|
||||
if (!(formData.code === '1' && formData.wechatType === 1)) {
|
||||
formData.subAppId = '';
|
||||
formData.subMchId = '';
|
||||
}
|
||||
console.log(form);
|
||||
const saveOrUpdate = isUpdate.value ? updatePayment : addPayment;
|
||||
saveOrUpdate(formData)
|
||||
|
||||
Reference in New Issue
Block a user