feat 基础依赖升级, 分账配置

This commit is contained in:
DaxPay
2024-12-09 19:48:27 +08:00
parent a67c0bb092
commit 7ce5a26d3f
5 changed files with 1831 additions and 1195 deletions

View File

@@ -56,12 +56,12 @@
"@ant-design/icons-vue": "^7.0.1", "@ant-design/icons-vue": "^7.0.1",
"@iconify/iconify": "^3.1.1", "@iconify/iconify": "^3.1.1",
"@vben/hooks": "workspace:*", "@vben/hooks": "workspace:*",
"@vue/shared": "^3.5.8", "@vue/shared": "^3.5.13",
"@vueuse/core": "^10.11.1", "@vueuse/core": "^10.11.1",
"@vueuse/shared": "^10.11.1", "@vueuse/shared": "^10.11.1",
"@zxcvbn-ts/core": "^3.0.4", "@zxcvbn-ts/core": "^3.0.4",
"ant-design-vue": "^4.2.5", "ant-design-vue": "^4.2.6",
"axios": "^1.7.7", "axios": "^1.7.9",
"codemirror": "^5.65.18", "codemirror": "^5.65.18",
"cropperjs": "^1.6.2", "cropperjs": "^1.6.2",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
@@ -73,31 +73,31 @@
"pinia": "2.1.7", "pinia": "2.1.7",
"pinia-plugin-persistedstate": "^3.2.3", "pinia-plugin-persistedstate": "^3.2.3",
"qrcode": "^1.5.4", "qrcode": "^1.5.4",
"qs": "^6.13.0", "qs": "^6.13.1",
"resize-observer-polyfill": "^1.5.1", "resize-observer-polyfill": "^1.5.1",
"showdown": "^2.1.0", "showdown": "^2.1.0",
"sortablejs": "^1.15.3", "sortablejs": "^1.15.6",
"unocss": "^0.59.4", "unocss": "^0.59.4",
"vue": "^3.5.8", "vue": "^3.5.13",
"vue-json-pretty": "^2.4.0", "vue-json-pretty": "^2.4.0",
"vue-router": "^4.4.5", "vue-router": "4.3.3",
"vue-types": "^5.1.3", "vue-types": "^5.1.3",
"vuedraggable": "^4.1.0", "vuedraggable": "^4.1.0",
"vxe-pc-ui": "^4.2.2", "vxe-pc-ui": "^4.3.23",
"vxe-table": "^4.7.81", "vxe-table": "^4.9.19",
"xe-utils": "^3.5.30" "xe-utils": "^3.5.32"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^19.5.0", "@commitlint/cli": "^19.6.0",
"@commitlint/config-conventional": "^19.5.0", "@commitlint/config-conventional": "^19.6.0",
"@iconify/json": "^2.2.252", "@iconify/json": "^2.2.281",
"@purge-icons/generated": "^0.10.0", "@purge-icons/generated": "^0.10.0",
"@types/codemirror": "^5.60.15", "@types/codemirror": "^5.60.15",
"@types/crypto-js": "^4.2.2", "@types/crypto-js": "^4.2.2",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/nprogress": "^0.2.3", "@types/nprogress": "^0.2.3",
"@types/qrcode": "^1.5.5", "@types/qrcode": "^1.5.5",
"@types/qs": "^6.9.16", "@types/qs": "^6.9.17",
"@types/showdown": "^2.0.6", "@types/showdown": "^2.0.6",
"@types/sortablejs": "^1.15.8", "@types/sortablejs": "^1.15.8",
"@vben/eslint-config": "workspace:*", "@vben/eslint-config": "workspace:*",
@@ -105,22 +105,22 @@
"@vben/ts-config": "workspace:*", "@vben/ts-config": "workspace:*",
"@vben/types": "workspace:*", "@vben/types": "workspace:*",
"@vben/vite-config": "workspace:*", "@vben/vite-config": "workspace:*",
"@vue/compiler-sfc": "^3.5.8", "@vue/compiler-sfc": "^3.5.13",
"@vue/test-utils": "^2.4.6", "@vue/test-utils": "^2.4.6",
"conventional-changelog-cli": "^4.1.0", "conventional-changelog-cli": "^4.1.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"cz-git": "^1.9.4", "cz-git": "^1.11.0",
"czg": "^1.9.4", "czg": "^1.11.0",
"lint-staged": "15.2.2", "lint-staged": "15.2.2",
"prettier": "^3.3.3", "prettier": "^3.4.2",
"prettier-plugin-packagejson": "^2.5.2", "prettier-plugin-packagejson": "^2.5.6",
"rimraf": "^5.0.10", "rimraf": "^5.0.10",
"turbo": "^1.13.4", "turbo": "^1.13.4",
"typescript": "^5.6.2", "typescript": "^5.7.2",
"unbuild": "^2.0.0", "unbuild": "^2.0.0",
"vite": "^5.4.7", "vite": "^5.4.11",
"vite-plugin-vue-devtools": "^7.4.5", "vite-plugin-vue-devtools": "^7.6.7",
"vue-tsc": "^2.1.6" "vue-tsc": "^2.1.10"
}, },
"engines": { "engines": {
"node": ">=18.12.0", "node": ">=18.12.0",

2803
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,18 +1,19 @@
<template> <template>
<basic-drawer <basic-drawer
destroyOnClose
v-bind="$attrs" v-bind="$attrs"
width="70%" width="70%"
title="分账配置" title="分账配置"
:mask-closable="true" :mask-closable="true"
:open="visible" :open="visible"
@close="visible = false" @close="visible = false"
> >
<a-tabs v-model:activeKey="activeKey" type="card"> <a-tabs v-model:activeKey="activeKey" type="card">
<a-tab-pane :key="1" tab="分账模式"> <a-tab-pane :key="1" tab="分账模式">
<AllocationConfig :appId="appId"/> <AllocationConfig :appId="appId" />
</a-tab-pane> </a-tab-pane>
<a-tab-pane :key="2" tab="分账接收方"> <a-tab-pane :key="2" tab="分账接收方">
<AllocationReceiverList :appId="appId"/> <AllocationReceiverList :appId="appId" />
</a-tab-pane> </a-tab-pane>
<a-tab-pane :key="3" tab="分账组"> <a-tab-pane :key="3" tab="分账组">
<AllocationGroupList :appId="appId" /> <AllocationGroupList :appId="appId" />
@@ -26,10 +27,10 @@
import AllocationGroupList from '@/views/daxpay/common/allocation/group/AllocationGroupList.vue' import AllocationGroupList from '@/views/daxpay/common/allocation/group/AllocationGroupList.vue'
import { ref } from 'vue' import { ref } from 'vue'
import { BasicDrawer } from '@/components/Drawer' import { BasicDrawer } from '@/components/Drawer'
import AllocationConfig from "@/views/daxpay/common/allocation/config/AllocationConfig.vue"; import AllocationConfig from '@/views/daxpay/common/allocation/config/AllocationConfig.vue'
const visible = ref(false) const visible = ref(false)
const activeKey = ref(2) const activeKey = ref(1)
const appId = ref('') const appId = ref('')
/** /**
@@ -37,11 +38,11 @@
* @param appid * @param appid
*/ */
function init(appid: string) { function init(appid: string) {
activeKey.value = 1
visible.value = true visible.value = true
appId.value = appid appId.value = appid
} }
defineExpose({ init }) defineExpose({ init })
</script> </script>

View File

@@ -0,0 +1,37 @@
import { defHttp } from '@/utils/http/axios'
import { Result } from '#/axios'
import { MchEntity } from '#/web'
/**
* 保存
*/
export function saveConfig(data: AllocConfig) {
return defHttp.post<Result<void>>({ url: '/allocation/config/save', data })
}
/**
* 更新
*/
export function updateConfig(data: AllocConfig) {
return defHttp.post<Result<void>>({ url: '/allocation/config/update', data })
}
/**
* 根据应用ID查询
*/
export function getConfig(appId) {
return defHttp.get<Result<AllocConfig>>({
url: '/allocation/config/findByAppId',
params: { appId },
})
}
/**
* 分账配置参数
*/
export interface AllocConfig extends MchEntity {
/** 是否自动分账 */
autoAlloc?: boolean
/** 大于多少开启分账 */
minAmount?: number
}

View File

@@ -1,11 +1,124 @@
<script setup lang="ts">
</script>
<template> <template>
<a-spin :spinning="confirmLoading">
<a-form
class="small-from-item"
:model="form"
ref="formRef"
:validate-trigger="['blur', 'change']"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-form-item label="主键" name="id" :hidden="true">
<a-input v-model:value="form.id" :disabled="showable" />
</a-form-item>
<a-form-item label="自动分账" name="autoAlloc">
<template #label>
<basic-title
helpMessage="开启自动分账后,如果创建订单时设置为了自动分账,将会对订单自动分账"
>
开启自动分账
</basic-title>
</template>
<a-radio-group v-model:value="form.autoAlloc" :disabled="!edit" button-style="solid">
<a-radio-button :value="false">关闭</a-radio-button>
<a-radio-button :value="true">开启</a-radio-button>
</a-radio-group>
</a-form-item>
<a-form-item name="minAmount">
<template #label>
<basic-title helpMessage="只有大于或等于其实金额的订单才会进行分账">
自动分账起始金额()
</basic-title>
</template>
<a-input-number
v-model:value="form.minAmount"
class="w-300px"
:min="0.1"
:max="9999999"
:disabled="!edit"
placeholder="请输自动分账起始金额(元)"
/>
</a-form-item>
</a-form>
<a-space :size="55" class="flex justify-center">
<a-button v-if="edit" @click="initData">取消</a-button>
<a-button v-if="edit" type="primary" @click="update">{{
form.id ? '更新' : '保存'
}}</a-button>
<a-button v-if="!edit" @click="edit = true">编辑信息</a-button>
</a-space>
</a-spin>
</template> </template>
<style scoped lang="less"> <script setup lang="ts">
import useFormEdit from '@/hooks/bootx/useFormEdit'
import { onMounted, ref } from 'vue'
import { FormInstance, Rule } from 'ant-design-vue/lib/form'
import { saveConfig, getConfig, updateConfig, AllocConfig } from './AllocationConfig.api'
import { useMessage } from '@/hooks/web/useMessage'
import BasicTitle from '@/components/Basic/src/BasicTitle.vue'
</style> const { labelCol, wrapperCol, confirmLoading, showable } = useFormEdit()
const { createMessage } = useMessage()
const edit = ref<boolean>(false)
const props = defineProps({
appId: String,
})
onMounted(() => {
initData()
})
// 表单
const formRef = ref<FormInstance>()
const form = ref<AllocConfig>({
autoAlloc: false,
minAmount: 1.0,
})
const rules = {
autoAlloc: [{ required: true, message: '' }],
minAmount: [{ required: true, message: '请输自动分账起始金额(元)' }],
} as Record<string, Rule[]>
/**
* 重置信息
*/
function initData() {
confirmLoading.value = true
edit.value = false
getConfig(props.appId).then(({ data }) => {
form.value = data
confirmLoading.value = false
form.value.appId = props.appId
})
}
/**
* 更新配置
*/
function update() {
formRef.value?.validate().then(async () => {
confirmLoading.value = true
if (form.value.id) {
updateConfig(form.value)
.then(() => {
edit.value = false
createMessage.success('更新成功')
})
.finally(() => (confirmLoading.value = false))
} else {
saveConfig(form.value)
.then(() => {
createMessage.success('保存成功')
initData()
})
.finally(() => (confirmLoading.value = false))
}
})
}
</script>
<style scoped lang="less"></style>