feat:商户权限

This commit is contained in:
dzc committed 2025-01-10 11:23:44 +08:00
1 parent 6fefe9d69c
commit 5f757796c8
5 files changed
+113 -96

No files matched your search

+4 -4
View File
@@ -8,15 +8,15 @@ VITE_OPEN = true
ENV = 'development'
# ADMIN 服务地址
VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/
# VITE_ADMIN_PROXY_PATH = http://123.156.230.15:8089/api/
# VITE_ADMIN_PROXY_PATH = http://pjcloud.center.takin.cc/
# VITE_ADMIN_PROXY_PATH = http://localhost:9999/
VITE_ADMIN_PROXY_PATH = http://localhost:9999/
# VITE_ADMIN_PROXY_PATH = http://192.168.101.29:9999/ # 邓-本地
# 图片访问基础地址
VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api
# VITE_IMAGE_BASE_PATH = http://123.156.230.15:8089/api
# VITE_IMAGE_BASE_PATH = http://pjcloud.center.takin.cc
# VITE_IMAGE_BASE_PATH = http://localhost:9999
VITE_IMAGE_BASE_PATH = http://localhost:9999
# VITE_IMAGE_BASE_PATH = http://192.168.101.29:9999 # 邓-本地
# 代码生成服务地址
+8
View File
@@ -0,0 +1,8 @@
{
"tabWidth": 2,
"useTabs": true,
"trailingComma": "all",
"semi": false,
"singleQuote": false,
"printWidth": 120
}
+26 -26
View File
@@ -1,58 +1,58 @@
import request from '/@/utils/request';
import request from "/@/utils/request"
export function pageJoinSelect(query?: Object) {
export function select(query?: Object) {
return request({
url: '/wallet/mch-manage/page-join-select',
method: 'get',
url: "/wallet/mch-manage/select",
method: "get",
params: query,
});
})
}
export function pageJoin(query?: Object) {
return request({
url: '/wallet/mch-manage/page-join',
method: 'get',
url: "/wallet/mch-manage/page-join",
method: "get",
params: query,
});
})
}
export function fetchList(query?: Object) {
return request({
url: '/wallet/mch-manage/page',
method: 'get',
url: "/wallet/mch-manage/page",
method: "get",
params: query,
});
})
}
export function addObj(obj?: Object) {
return request({
url: '/wallet/mch-manage',
method: 'post',
url: "/wallet/mch-manage",
method: "post",
data: obj,
});
})
}
export function getObj(id?: string) {
return request({
url: '/wallet/mch-manage/' + id,
method: 'get',
});
url: "/wallet/mch-manage/" + id,
method: "get",
})
}
export function delObjs(ids?: Object) {
return request({
url: '/wallet/mch-manage',
method: 'delete',
url: "/wallet/mch-manage",
method: "delete",
data: ids,
});
})
}
export function putObj(obj?: Object) {
return request({
url: '/wallet/mch-manage',
method: 'put',
url: "/wallet/mch-manage",
method: "put",
data: obj,
});
})
}
/**
@@ -61,10 +61,10 @@ export function putObj(obj?: Object) {
*/
export function selectMerchantList(type?: string) {
return request({
url: '/wallet/mch-manage/selectMerchantList',
method: 'get',
url: "/wallet/mch-manage/selectMerchantList",
method: "get",
params: {
type: type,
},
});
})
}
+36 -27
View File
@@ -1,7 +1,16 @@
<template>
<el-select style="width: 100%" v-model="state.selectId" :placeholder="props.placeholder" clearable
remote-show-suffix filterable remote :remote-method="remoteSearch" :loading="state.loading"
@visible-change="(e: boolean) => e && getOptions()">
<el-select
style="width: 100%"
v-model="state.selectId"
:placeholder="props.placeholder"
clearable
remote-show-suffix
filterable
remote
:remote-method="remoteSearch"
:loading="state.loading"
@visible-change="(e: boolean) => e && getOptions()"
>
<el-option v-for="v in state.options" :key="v.id" :label="`${v.name}`" :value="v.id">
<div class="flex items-center">
<div class="color-primary">{{ v.name }}</div>
@@ -16,62 +25,62 @@
</template>
<script setup lang="ts" name="select-merchant">
import { reactive, computed, defineModel, withDefaults, defineProps } from 'vue';
import * as mchApi from '/@/api/wallet/mch-manage';
import { reactive, defineModel, withDefaults, defineProps } from "vue"
import * as mchApi from "/@/api/wallet/mch-manage"
const selectId = defineModel();
const selectId = defineModel()
export type Props = {
placeholder?: string;
};
placeholder?: string
}
const props = withDefaults(defineProps<Props>(), {
placeholder: '请选择',
});
placeholder: "请选择",
})
const queryForm = reactive<any>({
name: '',
name: null,
current: 1,
size: 10,
});
})
const state = reactive<any>({
loading: true,
selectId: selectId,
options: [],
});
})
watch(
selectId,
(newVal, oldValue) => {
if (newVal == oldValue) return;
state.selectId = newVal;
getOptions();
if (newVal == oldValue) return
state.selectId = newVal
getOptions()
},
{ immediate: true }
);
{ immediate: true },
)
async function getOptions() {
try {
state.loading = true;
state.loading = true
const _pa = {
...queryForm,
};
const { data } = await mchApi.pageJoinSelect(_pa);
state.options = data.records ?? [];
}
const { data } = await mchApi.select(_pa)
state.options = data.records ?? []
} finally {
setTimeout(() => (state.loading = false), 500);
setTimeout(() => (state.loading = false), 500)
}
}
function remoteSearch(params: string) {
if (params != queryForm.name) {
queryForm.name = params;
getOptions();
queryForm.name = params
getOptions()
}
}
function clear() {
state.selectId = null;
getOptions();
state.selectId = null
getOptions()
}
</script>
+39 -39
View File
@@ -1,44 +1,44 @@
import vue from '@vitejs/plugin-vue';
import { resolve } from 'path';
import { defineConfig, loadEnv, ConfigEnv } from 'vite';
import vueSetupExtend from 'vite-plugin-vue-setup-extend';
import AutoImport from 'unplugin-auto-import/vite';
import topLevelAwait from 'vite-plugin-top-level-await';
import { createStyleImportPlugin, VxeTableResolve } from 'vite-plugin-style-import';
import viteCompression from 'vite-plugin-compression';
import vue from "@vitejs/plugin-vue"
import { resolve } from "path"
import { defineConfig, loadEnv, ConfigEnv } from "vite"
import vueSetupExtend from "vite-plugin-vue-setup-extend"
import AutoImport from "unplugin-auto-import/vite"
import topLevelAwait from "vite-plugin-top-level-await"
import { createStyleImportPlugin, VxeTableResolve } from "vite-plugin-style-import"
import viteCompression from "vite-plugin-compression"
// @ts-ignore
import { svgBuilder } from '/@/components/IconSelector/index';
import { svgBuilder } from "/@/components/IconSelector/index"
import dns from 'node:dns';
dns.setDefaultResultOrder('verbatim');
import dns from "node:dns"
dns.setDefaultResultOrder("verbatim")
const pathResolve = (dir: string) => {
return resolve(__dirname, '.', dir);
};
return resolve(__dirname, ".", dir)
}
const alias: Record<string, string> = {
'/@': pathResolve('./src/'),
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js',
};
"/@": pathResolve("./src/"),
"vue-i18n": "vue-i18n/dist/vue-i18n.cjs.js",
}
const viteConfig = defineConfig((mode: ConfigEnv) => {
const env = loadEnv(mode.mode, process.cwd());
const env = loadEnv(mode.mode, process.cwd())
// 判断是否开发环境
const isDev = env.ENV === 'development';
const isDev = env.ENV === "development"
return {
plugins: [
vue(), // Vue 插件
svgBuilder('./src/assets/icons/'), // 将 SVG 文件转换成 Vue 组件
svgBuilder("./src/assets/icons/"), // 将 SVG 文件转换成 Vue 组件
vueSetupExtend(), // setup语法糖增强插件
AutoImport({
imports: ['vue', 'vue-router', 'pinia'], // 自动导入的依赖库数组
dts: './auto-imports.d.ts', // 自动导入类型定义文件路径
imports: ["vue", "vue-router", "pinia"], // 自动导入的依赖库数组
dts: "./auto-imports.d.ts", // 自动导入类型定义文件路径
}),
createStyleImportPlugin({
resolves: [VxeTableResolve()], // 配置vxetable 按需加载
}),
topLevelAwait({
promiseExportName: '__tla', // TLA Promise 变量名
promiseExportName: "__tla", // TLA Promise 变量名
promiseImportName: (i) => `__tla_${i}`, // TLA Promise 导入名
}),
viteCompression({
@@ -47,29 +47,29 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
],
root: process.cwd(), // 项目根目录
resolve: { alias }, // 路径别名配置
base: mode.command === 'serve' ? './' : env.VITE_PUBLIC_PATH,
base: mode.command === "serve" ? "./" : env.VITE_PUBLIC_PATH,
optimizeDeps: {
include: ['element-plus/es/locale/lang/zh-cn', 'element-plus/es/locale/lang/en'],
include: ["element-plus/es/locale/lang/zh-cn", "element-plus/es/locale/lang/en"],
},
server: {
host: '0.0.0.0', // 服务器地址
host: "0.0.0.0", // 服务器地址
port: env.VITE_PORT as unknown as number, // 服务器端口号
open: env.VITE_OPEN === 'true', // 是否自动打开浏览器
open: env.VITE_OPEN === "true", // 是否自动打开浏览器
hmr: true, // 启用热更新
proxy: {
'/api/gen': {
"/api/gen": {
//单体架构下特殊处理代码生成模块代理
target: env.VITE_IS_MICRO === 'true' ? env.VITE_ADMIN_PROXY_PATH : env.VITE_GEN_PROXY_PATH,
target: env.VITE_IS_MICRO === "true" ? env.VITE_ADMIN_PROXY_PATH : env.VITE_GEN_PROXY_PATH,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
rewrite: (path) => path.replace(/^\/api/, ""),
},
'/api': {
"/api": {
target: env.VITE_ADMIN_PROXY_PATH, // 目标服务器地址
ws: true, // 是否启用 WebSocket
changeOrigin: true, // 是否修改请求头中的 Origin 字段
rewrite: (path) => path.replace(/^\/api/, ''),
rewrite: (path) => path.replace(/^\/api/, ""),
},
'^/ws/info/.*': {
"^/ws/info/.*": {
target: env.VITE_ADMIN_PROXY_PATH, // 目标服务器地址
ws: true, // 是否启用 WebSocket
changeOrigin: true,
@@ -77,10 +77,10 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
},
},
build: {
outDir: 'dist', // 打包输出目录//
outDir: "dist", // 打包输出目录//
chunkSizeWarningLimit: 1500, // 代码分包阈值
// 开发使用 esbuild 更快,生产环境打包使用 terser 可以删除更多注释
minify: isDev ? 'esbuild' : 'terser',
minify: isDev ? "esbuild" : "terser",
terserOptions: {
compress: {
drop_console: true, // 删除 console
@@ -97,8 +97,8 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
assetFileNames: `assets/[name].[hash].[ext]`,
compact: true,
manualChunks: {
vue: ['vue', 'vue-router', 'pinia'],
echarts: ['echarts'],
vue: ["vue", "vue-router", "pinia"],
echarts: ["echarts"],
},
},
},
@@ -111,7 +111,7 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
__VERSION__: JSON.stringify(process.env.npm_package_version),
__NEXT_NAME__: JSON.stringify(process.env.npm_package_name),
},
};
});
}
})
export default viteConfig;
export default viteConfig