From a4bb5626dcf18a1893792eeeca75e9139c744ad0 Mon Sep 17 00:00:00 2001 From: wupengfei <834520024@qq.com> Date: 星期一, 13 十月 2025 16:30:45 +0800 Subject: [PATCH] Merge branch 'dev-1.1.2' of http://120.26.58.240:8888/r/flexJobAdmin into dev-1.1.2 --- src/utils/common/file.ts | 4 src/views/EnterpriseManage/components/WeChatPayWalletBankBranchAreaCascader.vue | 93 +++++++++++ src/components/Form/ProFormPaginationSelect.vue | 35 ++++ src/components/Form/FieldPaginationSelect.vue | 37 ++++ src/views/EnterpriseManage/components/WechatConfigureView.vue | 141 ++++++++++------ src/views/EnterpriseManage/components/WeChatPayWalletBankBranchsSelect.vue | 72 +++++++++ src/views/EnterpriseManage/components/WeChatPayWalletBanksSelect.vue | 78 +++++++++ 7 files changed, 406 insertions(+), 54 deletions(-) diff --git a/src/components/Form/FieldPaginationSelect.vue b/src/components/Form/FieldPaginationSelect.vue new file mode 100644 index 0000000..82e5bbf --- /dev/null +++ b/src/components/Form/FieldPaginationSelect.vue @@ -0,0 +1,37 @@ +<template> + <div> + <el-select v-model="modelValue" v-bind="{ ...$attrs }"> + <el-option + v-for="item in proTableProps.tableData" + :key="item[props.enumValueKey]" + :label="item[props.enumLabelKey]" + :value="item[props.enumValueKey]" + > + </el-option> + <template #footer> + <ProPagination v-bind="proTableProps" layout="total, prev, pager, next"></ProPagination> + </template> + </el-select> + </div> +</template> + +<script setup lang="ts"> +import { ProPagination } from '@bole-core/components'; + +defineOptions({ + name: 'FieldPaginationSelect', +}); + +type Props = { + proTableProps: any; + enumLabelKey?: string; + enumValueKey?: string; +}; + +const props = withDefaults(defineProps<Props>(), { + enumLabelKey: 'label', + enumValueKey: 'value', +}); + +const modelValue = defineModel<string>(); +</script> diff --git a/src/components/Form/ProFormPaginationSelect.vue b/src/components/Form/ProFormPaginationSelect.vue new file mode 100644 index 0000000..384b2d8 --- /dev/null +++ b/src/components/Form/ProFormPaginationSelect.vue @@ -0,0 +1,35 @@ +<template> + <ProFieldCustom> + <FieldPaginationSelect + v-model="modelValue" + :proTableProps="proTableProps" + v-bind="{ ...$attrs }" + :enumLabelKey="enumLabelKey" + :enumValueKey="enumValueKey" + /> + </ProFieldCustom> +</template> + +<script setup lang="ts"> +import { ProFieldCustom } from '@bole-core/components'; +import FieldPaginationSelect from './FieldPaginationSelect.vue'; + +defineOptions({ + name: 'ProFormPaginationSelect', +}); + +type Props = { + proTableProps: any; + enumLabelKey?: string; + enumValueKey?: string; +}; + +const props = withDefaults(defineProps<Props>(), {}); +console.log('props: ', props); + +const modelValue = defineModel<string>(); +</script> + +<style lang="scss" scoped> +@use '@/style/common.scss' as *; +</style> diff --git a/src/utils/common/file.ts b/src/utils/common/file.ts index 25cbd9a..a7da7d5 100644 --- a/src/utils/common/file.ts +++ b/src/utils/common/file.ts @@ -25,6 +25,10 @@ return path ? [convertApi2FormUrl(path)] : []; } +export function convertApi2FormUrls(paths: string[]): UploadUserFile[] { + return paths?.length > 0 ? paths.map((x) => convertApi2FormUrl(x)) : []; +} + /** * 鎶妘pload鐨勮矾寰勮浆鎹负涓婁紶鍒癮pi鐨勮矾寰� */ diff --git a/src/views/EnterpriseManage/components/WeChatPayWalletBankBranchAreaCascader.vue b/src/views/EnterpriseManage/components/WeChatPayWalletBankBranchAreaCascader.vue new file mode 100644 index 0000000..6d59ea7 --- /dev/null +++ b/src/views/EnterpriseManage/components/WeChatPayWalletBankBranchAreaCascader.vue @@ -0,0 +1,93 @@ +<template> + <ProFieldCustom> + <div class="address-select"> + <el-cascader + v-bind="areaByCascaderProps" + v-model="areaList" + :placeholder="placeholder" + clearable + :value-on-clear="() => []" + ></el-cascader> + </div> + </ProFieldCustom> +</template> + +<script setup lang="ts"> +import { ProFieldCustom } from '@bole-core/components'; +import { CascaderProps } from 'element-plus'; +import * as enterpriseWalletServices from '@/services/api/enterpriseWallet'; +import { useQueryClient } from '@tanstack/vue-query'; + +defineOptions({ + name: 'WeChatPayWalletBankBranchAreaCascader', +}); + +type Props = { + placeholder?: string; +}; + +const props = withDefaults(defineProps<Props>(), {}); + +const areaList = defineModel<number[]>('areaList'); + +const queryClient = useQueryClient(); + +function getEnterpriseWeChatPayWalletBankProvinces() { + return queryClient.fetchQuery({ + queryKey: ['enterpriseWalletServices/getEnterpriseWeChatPayWalletBankProvinces'], + queryFn: async () => { + let res = await enterpriseWalletServices.getEnterpriseWeChatPayWalletBankProvinces( + {}, + { showLoading: false } + ); + return res.map((x) => ({ + areaName: x.province_name, + areaCode: x.province_code, + })); + }, + staleTime: Infinity, + }); +} + +function getEnterpriseWeChatPayWalletBankCities(provinceCode: number) { + return queryClient.fetchQuery({ + queryKey: ['enterpriseWalletServices/getEnterpriseWeChatPayWalletBankCities', provinceCode], + queryFn: async () => { + let res = await enterpriseWalletServices.getEnterpriseWeChatPayWalletBankCities( + { + provinceCode: provinceCode, + }, + { showLoading: false } + ); + return res.map((x) => ({ + areaName: x.city_name, + areaCode: x.city_code, + })); + }, + staleTime: Infinity, + }); +} + +const areaByCascaderProps = { + props: { + label: 'areaName', + value: 'areaCode', + lazy: true, + async lazyLoad(node, resolve) { + const { level, data, value } = node; + console.log('value: ', value); + const areas = + level === 0 + ? await getEnterpriseWeChatPayWalletBankProvinces() + : await getEnterpriseWeChatPayWalletBankCities(value as any); + + return resolve( + areas.map((x) => ({ + ...x, + leaf: level >= 1, + })) + ); + }, + } as CascaderProps, +}; +</script> diff --git a/src/views/EnterpriseManage/components/WeChatPayWalletBankBranchsSelect.vue b/src/views/EnterpriseManage/components/WeChatPayWalletBankBranchsSelect.vue new file mode 100644 index 0000000..4ef58ea --- /dev/null +++ b/src/views/EnterpriseManage/components/WeChatPayWalletBankBranchsSelect.vue @@ -0,0 +1,72 @@ +<template> + <ProFormPaginationSelect + v-model="bank_branch_id" + :proTableProps="proTableProps" + enum-label-key="bank_branch_name" + enum-value-key="bank_branch_id" + > + </ProFormPaginationSelect> +</template> + +<script setup lang="ts"> +import { useTable } from '@bole-core/components'; +import * as enterpriseWalletServices from '@/services/api/enterpriseWallet'; + +defineOptions({ + name: 'WeChatPayWalletBankBranchsSelect', +}); + +type Props = { + bank_alias_code: string; + city_code: number; + need_bank_branch: boolean; +}; + +const props = withDefaults(defineProps<Props>(), {}); + +const bank_branch_id = defineModel<string>('bank_branch_id'); + +watch( + [toRef(props, 'bank_alias_code'), toRef(props, 'city_code'), toRef(props, 'need_bank_branch')], + ([bank_alias_code, city_code, need_bank_branch]) => { + bank_branch_id.value = ''; + if (need_bank_branch) { + getList(); + } + } +); + +const { + getDataSource: getList, + proTableProps, + paginationState, + extraParamState, + reset, +} = useTable( + async ({ pageIndex, pageSize }, extraParamState) => { + try { + let params: API.GetEnterpriseWeChatPayWalletBankBranchesQuery = { + pageModel: { + rows: pageSize, + page: pageIndex, + }, + bank_alias_code: props.bank_alias_code, + city_code: props.city_code, + }; + + let res = await enterpriseWalletServices.getEnterpriseWeChatPayWalletBankBranches(params, { + showLoading: true, + }); + return res; + } catch (error) { + console.log('error: ', error); + } + }, + { + defaultExtraParams: { + keywords: '', + }, + queryKey: ['enterpriseWalletServices/getEnterpriseWeChatPayWalletBankBranches'], + } +); +</script> diff --git a/src/views/EnterpriseManage/components/WeChatPayWalletBanksSelect.vue b/src/views/EnterpriseManage/components/WeChatPayWalletBanksSelect.vue new file mode 100644 index 0000000..cdace6d --- /dev/null +++ b/src/views/EnterpriseManage/components/WeChatPayWalletBanksSelect.vue @@ -0,0 +1,78 @@ +<template> + <ProFormPaginationSelect + v-model="bank_alias" + :proTableProps="proTableProps" + @change="handleAccountBankChange" + enum-label-key="bank_alias" + enum-value-key="bank_alias" + > + </ProFormPaginationSelect> +</template> + +<script setup lang="ts"> +import { useTable } from '@bole-core/components'; +import * as enterpriseWalletServices from '@/services/api/enterpriseWallet'; + +defineOptions({ + name: 'WeChatPayWalletBanksSelect', +}); + +// type Props = { +// }; + +// const props = withDefaults(defineProps<Props>(), {}); + +const bank_alias = defineModel<string>('bank_alias'); +const account_bank = defineModel<string>('account_bank'); +const account_bank_code = defineModel<number>('account_bank_code'); +const bank_alias_code = defineModel<string>('bank_alias_code'); +const need_bank_branch = defineModel<boolean>('need_bank_branch'); + +onMounted(() => { + getList(); +}); + +const { + getDataSource: getList, + proTableProps, + paginationState, + extraParamState, + reset, +} = useTable( + async ({ pageIndex, pageSize }, extraParamState) => { + try { + let params: API.GetEnterpriseWeChatPayWalletBanksQuery = { + pageModel: { + rows: pageSize, + page: pageIndex, + }, + bank_account_type: 0, + }; + + let res = await enterpriseWalletServices.getEnterpriseWeChatPayWalletBanks(params, { + showLoading: true, + }); + return res; + } catch (error) { + console.log('error: ', error); + } + }, + { + defaultExtraParams: { + keywords: '', + }, + queryKey: ['enterpriseWalletServices/getEnterpriseWeChatPayWalletBanks'], + } +); + +function handleAccountBankChange(bank_alias: string) { + console.log('bank_alias: ', bank_alias); + const bank = proTableProps.value.tableData.find((item) => item.bank_alias === bank_alias); + if (bank) { + account_bank.value = bank.account_bank; + account_bank_code.value = bank.account_bank_code; + bank_alias_code.value = bank.bank_alias_code; + need_bank_branch.value = bank.need_bank_branch; + } +} +</script> diff --git a/src/views/EnterpriseManage/components/WechatConfigureView.vue b/src/views/EnterpriseManage/components/WechatConfigureView.vue index 1241dac..7fb4112 100644 --- a/src/views/EnterpriseManage/components/WechatConfigureView.vue +++ b/src/views/EnterpriseManage/components/WechatConfigureView.vue @@ -902,12 +902,21 @@ </ProFormItemV2> <ProFormItemV2 label="寮�鎴烽摱琛�:" - prop="account_bank" + prop="bank_alias" :checkRules="[{ message: '璇疯緭鍏ュ紑鎴烽摱琛�' }]" > - <ProFormText v-model.trim="form.account_bank" placeholder="璇疯緭鍏ュ紑鎴烽摱琛�" /> + <!-- <ProFormText v-model.trim="form.account_bank" placeholder="璇疯緭鍏ュ紑鎴烽摱琛�" /> --> + <WeChatPayWalletBanksSelect + v-model:bank_alias="form.bank_alias" + v-model:account_bank="form.account_bank" + v-model:account_bank_code="form.account_bank_code" + v-model:bank_alias_code="form.bank_alias_code" + v-model:need_bank_branch="form.need_bank_branch" + placeholder="璇疯緭鍏ュ紑鎴烽摱琛�" + clearable + /> </ProFormItemV2> - <ProFormItemV2 + <!-- <ProFormItemV2 label="寮�鎴烽摱琛岀渷甯傜紪鐮�:" prop="bank_address_code" :checkRules="[{ message: '璇疯緭鍏ュ紑鎴烽摱琛岀渷甯傜紪鐮�' }]" @@ -918,21 +927,36 @@ >鐪佸競缂栫爜妯℃澘</el-button > </div> - </ProFormItemV2> - <ProFormItemV2 - label="寮�鎴烽摱琛岄摱琛屽彿:" - prop="bank_branch_id" - :checkRules="[{ message: '璇疯緭鍏ュ紑鎴烽摱琛岄摱琛屽彿' }]" - > - <ProFormText v-model.trim="form.bank_branch_id" placeholder="璇疯緭鍏ュ紑鎴烽摱琛岄摱琛屽彿" /> - </ProFormItemV2> - <ProFormItemV2 - label="寮�鎴烽摱琛屽叏绉�(鍚敮琛�):" - prop="bank_name" - :checkRules="[{ message: '璇疯緭鍏ュ紑鎴烽摱琛屽叏绉�(鍚敮琛�)' }]" - > - <ProFormText v-model.trim="form.bank_name" placeholder="璇疯緭鍏ュ紑鎴烽摱琛屽叏绉�(鍚敮琛�)" /> - </ProFormItemV2> + </ProFormItemV2> --> + <template v-if="form.need_bank_branch"> + <!-- <ProFormItemV2 + label="寮�鎴烽摱琛岄摱琛屽彿:" + prop="bank_branch_id" + :checkRules="[{ message: '璇疯緭鍏ュ紑鎴烽摱琛岄摱琛屽彿' }]" + > + <ProFormText v-model.trim="form.bank_branch_id" placeholder="璇疯緭鍏ュ紑鎴烽摱琛岄摱琛屽彿" /> + </ProFormItemV2> --> + <ProFormItemV2 + label="寮�鎴锋敮琛岀渷甯傜紪鐮�:" + prop="bank_branch_area" + :checkRules="[{ message: '璇疯緭鍏ュ紑鎴烽摱琛岄摱琛屽彿', type: 'array' }]" + > + <WeChatPayWalletBankBranchAreaCascader v-model:areaList="form.bank_branch_area" /> + </ProFormItemV2> + <ProFormItemV2 + label="寮�鎴烽摱琛屽叏绉�(鍚敮琛�):" + prop="bank_branch_id" + :checkRules="[{ message: '璇疯緭鍏ュ紑鎴烽摱琛屽叏绉�(鍚敮琛�)' }]" + > + <WeChatPayWalletBankBranchsSelect + v-model:bank_branch_id="form.bank_branch_id" + placeholder="璇疯緭鍏�" + :bank_alias_code="form.bank_alias_code" + :need_bank_branch="form.need_bank_branch" + :city_code="form.bank_branch_area?.[1]" + /> + </ProFormItemV2> + </template> <ProFormItemV2 label="閾惰璐﹀彿:" prop="account_number" @@ -980,8 +1004,17 @@ EnumWeChatPayApplymentSalesScenesTypeText, EnumWeChatPayApplymentBankAccountTypeText, } from '@/constants'; -import { convertApi2FormUrl, convertApi2FormUrlOnlyOne, downloadFileByUrl, format } from '@/utils'; +import { + convertApi2FormUrl, + convertApi2FormUrlOnlyOne, + downloadFileByUrl, + format, + convertApi2FormUrls, +} from '@/utils'; import { Message } from '@bole-core/core'; +import WeChatPayWalletBanksSelect from './WeChatPayWalletBanksSelect.vue'; +import WeChatPayWalletBankBranchsSelect from './WeChatPayWalletBankBranchsSelect.vue'; +import WeChatPayWalletBankBranchAreaCascader from './WeChatPayWalletBankBranchAreaCascader.vue'; defineOptions({ name: 'WechatConfigureView', @@ -1073,6 +1106,11 @@ bank_branch_id: '', bank_name: '', account_number: '', + bank_alias_code: '', + bank_alias: '', + account_bank_code: '' as any as number, + need_bank_branch: false, + bank_branch_area: [] as number[], }); const EnumWeChatPayApplymentCertTypeTextList = computed(() => { @@ -1120,7 +1158,7 @@ form.business_code = data.business_code ?? ''; form.contact_type = data.contact_info?.contact_type; form.contact_name = data.contact_info?.contact_name ?? ''; - form.contact_id_doc_type = data.contact_info?.contact_id_doc_type; + form.contact_id_doc_type = data.contact_info?.contact_id_doc_type ?? ('' as any); form.contact_id_number = data.contact_info?.contact_id_number ?? ''; form.contact_id_doc_copy = convertApi2FormUrlOnlyOne( data.contact_info?.contact_id_doc_copy ?? '' @@ -1203,55 +1241,36 @@ form.biz_address_code = data.business_info?.sales_info?.biz_store_info?.biz_address_code; form.biz_store_address = data.business_info?.sales_info?.biz_store_info?.biz_store_address ?? ''; - form.store_entrance_pic = - data.business_info?.sales_info?.biz_store_info?.store_entrance_pic.length > 0 - ? data.business_info?.sales_info?.biz_store_info?.store_entrance_pic.map((x) => - convertApi2FormUrl(x) - ) - : []; - form.indoor_pic = - data.business_info?.sales_info?.biz_store_info?.indoor_pic.length > 0 - ? data.business_info?.sales_info?.biz_store_info?.indoor_pic.map((x) => - convertApi2FormUrl(x) - ) - : []; + form.store_entrance_pic = convertApi2FormUrls( + data.business_info?.sales_info?.biz_store_info?.store_entrance_pic + ); + form.indoor_pic = convertApi2FormUrls( + data.business_info?.sales_info?.biz_store_info?.indoor_pic + ); form.mp_appid = data.business_info?.sales_info?.mp_info?.mp_appid ?? ''; form.mp_sub_appid = data.business_info?.sales_info?.mp_info?.mp_sub_appid ?? ''; - form.mp_pics = - data.business_info?.sales_info?.mp_info?.mp_pics.length > 0 - ? data.business_info?.sales_info?.mp_info?.mp_pics.map((x) => convertApi2FormUrl(x)) - : []; + form.mp_pics = convertApi2FormUrls(data.business_info?.sales_info?.mp_info?.mp_pics); form.mini_program_appid = data.business_info?.sales_info?.mini_program_info?.mini_program_appid ?? ''; form.mini_program_sub_appid = data.business_info?.sales_info?.mini_program_info?.mini_program_sub_appid ?? ''; - form.mini_program_pics = - data.business_info?.sales_info?.mini_program_info?.mini_program_pics.length > 0 - ? data.business_info?.sales_info?.mini_program_info?.mini_program_pics.map((x) => - convertApi2FormUrl(x) - ) - : []; + form.mini_program_pics = convertApi2FormUrls( + data.business_info?.sales_info?.mini_program_info?.mini_program_pics + ); form.app_appid = data.business_info?.sales_info?.app_info?.app_appid ?? ''; form.app_sub_appid = data.business_info?.sales_info?.app_info?.app_sub_appid ?? ''; - form.app_pics = - data.business_info?.sales_info?.app_info?.app_pics.length > 0 - ? data.business_info?.sales_info?.app_info?.app_pics.map((x) => convertApi2FormUrl(x)) - : []; + form.app_pics = convertApi2FormUrls(data.business_info?.sales_info?.app_info?.app_pics); form.domain = data.business_info?.sales_info?.web_info?.domain ?? ''; form.web_authorisation = convertApi2FormUrlOnlyOne( data.business_info?.sales_info?.web_info?.web_authorisation ?? '' ); form.sub_corp_id = data.business_info?.sales_info?.wework_info?.sub_corp_id ?? ''; - form.wework_pics = - data.business_info?.sales_info?.wework_info?.wework_pics.length > 0 - ? data.business_info?.sales_info?.wework_info?.wework_pics.map((x) => convertApi2FormUrl(x)) - : []; + form.wework_pics = convertApi2FormUrls( + data.business_info?.sales_info?.wework_info?.wework_pics + ); form.settlement_id = data.settlement_info?.settlement_id ?? ''; form.qualification_type = data.settlement_info?.qualification_type ?? ''; - form.qualifications = - data.settlement_info?.qualifications?.length > 0 - ? data.settlement_info?.qualifications.map((x) => convertApi2FormUrl(x)) - : []; + form.qualifications = convertApi2FormUrls(data.settlement_info?.qualifications); form.bank_account_type = data.bank_account_info?.bank_account_type; form.account_name = data.bank_account_info?.account_name ?? ''; form.account_bank = data.bank_account_info?.account_bank ?? ''; @@ -1259,6 +1278,14 @@ form.bank_branch_id = data.bank_account_info?.bank_branch_id ?? ''; form.bank_name = data.bank_account_info?.bank_name ?? ''; form.account_number = data.bank_account_info?.account_number ?? ''; + form.bank_alias_code = data.bank_account_info?.bank_alias_code ?? ''; + form.bank_alias = data.bank_account_info?.bank_alias ?? ''; + form.account_bank_code = data.bank_account_info?.account_bank_code; + form.need_bank_branch = data.bank_account_info?.need_bank_branch ?? false; + form.bank_branch_area = [ + data.bank_account_info?.province_code, + data.bank_account_info?.city_code, + ].filter(Boolean); }, }); @@ -1438,6 +1465,12 @@ bank_branch_id: form.bank_branch_id, bank_name: form.bank_name, account_number: form.account_number, + bank_alias_code: form.bank_alias_code, + province_code: form.bank_branch_area?.[0], + city_code: form.bank_branch_area?.[1], + bank_alias: form.bank_alias, + account_bank_code: form.account_bank_code, + need_bank_branch: form.need_bank_branch, }, }; let res = await enterpriseWalletServices.openEnterpriseWeChatPayWallet(params); -- Gitblit v1.9.1