Merge branch 'master' into dev-v1.1
|  |  |  | 
|---|
|  |  |  | "EnumEnterpriseCostType": true, | 
|---|
|  |  |  | "EnumEnterpriseRealMethod": true, | 
|---|
|  |  |  | "EnumEnterpriseWalletAccess": true, | 
|---|
|  |  |  | "EnumEnterpriseWalletAccessText": true, | 
|---|
|  |  |  | "EnumEnterpriseWalletExpandindirectOrderFileType": true, | 
|---|
|  |  |  | "EnumEnterpriseWalletExpandindirectOrderScene": true, | 
|---|
|  |  |  | "EnumEnterpriseWalletExpandindirectOrderStatus": true, | 
|---|
|  |  |  | 
|---|
|  |  |  | const EnumEnterpriseCostType: typeof import('./src/constants/apiEnum')['EnumEnterpriseCostType'] | 
|---|
|  |  |  | const EnumEnterpriseRealMethod: typeof import('./src/constants/apiEnum')['EnumEnterpriseRealMethod'] | 
|---|
|  |  |  | const EnumEnterpriseWalletAccess: typeof import('./src/constants/apiEnum')['EnumEnterpriseWalletAccess'] | 
|---|
|  |  |  | const EnumEnterpriseWalletAccessText: typeof import('./src/constants/enterpriseWallet')['EnumEnterpriseWalletAccessText'] | 
|---|
|  |  |  | const EnumEnterpriseWalletExpandindirectOrderFileType: typeof import('./src/constants/apiEnum')['EnumEnterpriseWalletExpandindirectOrderFileType'] | 
|---|
|  |  |  | const EnumEnterpriseWalletExpandindirectOrderScene: typeof import('./src/constants/apiEnum')['EnumEnterpriseWalletExpandindirectOrderScene'] | 
|---|
|  |  |  | const EnumEnterpriseWalletExpandindirectOrderStatus: typeof import('./src/constants/apiEnum')['EnumEnterpriseWalletExpandindirectOrderStatus'] | 
|---|
|  |  |  | 
|---|
|  |  |  | readonly EnumEnterpriseCostType: UnwrapRef<typeof import('./src/constants/apiEnum')['EnumEnterpriseCostType']> | 
|---|
|  |  |  | readonly EnumEnterpriseRealMethod: UnwrapRef<typeof import('./src/constants/apiEnum')['EnumEnterpriseRealMethod']> | 
|---|
|  |  |  | readonly EnumEnterpriseWalletAccess: UnwrapRef<typeof import('./src/constants/apiEnum')['EnumEnterpriseWalletAccess']> | 
|---|
|  |  |  | readonly EnumEnterpriseWalletAccessText: UnwrapRef<typeof import('./src/constants/enterpriseWallet')['EnumEnterpriseWalletAccessText']> | 
|---|
|  |  |  | readonly EnumEnterpriseWalletExpandindirectOrderFileType: UnwrapRef<typeof import('./src/constants/apiEnum')['EnumEnterpriseWalletExpandindirectOrderFileType']> | 
|---|
|  |  |  | readonly EnumEnterpriseWalletExpandindirectOrderScene: UnwrapRef<typeof import('./src/constants/apiEnum')['EnumEnterpriseWalletExpandindirectOrderScene']> | 
|---|
|  |  |  | readonly EnumEnterpriseWalletExpandindirectOrderStatus: UnwrapRef<typeof import('./src/constants/apiEnum')['EnumEnterpriseWalletExpandindirectOrderStatus']> | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | import { EnumEnterpriseWalletAccess } from './apiEnum'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export const EnumEnterpriseWalletAccessText = { | 
|---|
|  |  |  | [EnumEnterpriseWalletAccess.Alipay]: '支付宝', | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | 
|---|
|  |  |  | export * from './task'; | 
|---|
|  |  |  | export * from './enterpriseEmployee'; | 
|---|
|  |  |  | export * from './electronSign'; | 
|---|
|  |  |  | export * from './enterpriseWallet'; | 
|---|
|  |  |  | 
|---|
|  |  |  | export function useUser() { | 
|---|
|  |  |  | const userStore = useUserStore(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const { userId, userInfo } = storeToRefs(userStore); | 
|---|
|  |  |  | const { userId, userInfo, userDetail } = storeToRefs(userStore); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | user: userInfo, | 
|---|
|  |  |  | userId: userId, | 
|---|
|  |  |  | userDetail: userDetail, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | setUserInfo, | 
|---|
|  |  |  | getUserInfo, | 
|---|
|  |  |  | md5Encrypt, | 
|---|
|  |  |  | getUserDetail, | 
|---|
|  |  |  | setUserDetail, | 
|---|
|  |  |  | removeUserDetail, | 
|---|
|  |  |  | } from '@/utils'; | 
|---|
|  |  |  | import { resetRouter, router } from '@/router'; | 
|---|
|  |  |  | import { useTagsViewStoreHook } from './tagsView'; | 
|---|
|  |  |  | 
|---|
|  |  |  | export interface UserState { | 
|---|
|  |  |  | token: string; | 
|---|
|  |  |  | userInfo: API.LoginCommandCallback; | 
|---|
|  |  |  | userDetail?: Nullable<API.GetEnterpriseLoginInfoQueryResult>; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function getDefaultState() { | 
|---|
|  |  |  | const accessToken = getToken(); | 
|---|
|  |  |  | const userInfo = getUserInfo(); | 
|---|
|  |  |  | const userDetail = getUserDetail(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return { | 
|---|
|  |  |  | token: accessToken, | 
|---|
|  |  |  | userInfo: userInfo || {}, | 
|---|
|  |  |  | userDetail: userDetail, | 
|---|
|  |  |  | } as UserState; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | setUserInfo(userInfo); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | setUserDetail(detail: API.GetEnterpriseLoginInfoQueryResult) { | 
|---|
|  |  |  | this.userDetail = detail; | 
|---|
|  |  |  | setUserDetail(detail); | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 用户登入 | 
|---|
|  |  |  | async loginByUsername(params: API.PasswordLoginCommand) { | 
|---|
|  |  |  | let res = await authServices.passwordLogin( | 
|---|
|  |  |  | 
|---|
|  |  |  | if (res) { | 
|---|
|  |  |  | this.setToken(res.accessToken); | 
|---|
|  |  |  | this.setUserInfo(res); | 
|---|
|  |  |  | this.getCurrentUserInfo(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | async getCurrentUserInfo() { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | let res = await authServices.getEnterpriseLoginInfo({}, { showLoading: false }); | 
|---|
|  |  |  | if (res) { | 
|---|
|  |  |  | // res.frontStatus = getUserCertificationFrontStatusAdapter( | 
|---|
|  |  |  | //   res.userCertificationStatus, | 
|---|
|  |  |  | //   res.userCertificationAuditStatus | 
|---|
|  |  |  | // ); | 
|---|
|  |  |  | this.setUserDetail(res); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 登出 清空缓存 | 
|---|
|  |  |  | 
|---|
|  |  |  | return new Promise(async (resolve) => { | 
|---|
|  |  |  | removeToken(); | 
|---|
|  |  |  | removeUserInfo(); | 
|---|
|  |  |  | removeUserDetail(); | 
|---|
|  |  |  | this.resetState(); | 
|---|
|  |  |  | resetRouter(); | 
|---|
|  |  |  | myClient.removeQueries(); | 
|---|
|  |  |  | 
|---|
|  |  |  | TOKEN_KEY: 'TOKEN__', | 
|---|
|  |  |  | REFRESH_TOKEN_KEY: 'REFRESH__TOKEN__', | 
|---|
|  |  |  | USER_INFO_KEY: 'USER__INFO__', | 
|---|
|  |  |  | USER_DETAIL_KEY: 'USER_DETAIL_KEY', | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export function getToken() { | 
|---|
|  |  |  | 
|---|
|  |  |  | export function removeUserInfo() { | 
|---|
|  |  |  | return storageLocal.removeItem(StorageKey.USER_INFO_KEY); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export function getUserDetail() { | 
|---|
|  |  |  | return storageLocal.getItem<API.GetEnterpriseLoginInfoQueryResult>(StorageKey.USER_DETAIL_KEY); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export function setUserDetail(userDetail: API.GetEnterpriseLoginInfoQueryResult) { | 
|---|
|  |  |  | return storageLocal.setItem(StorageKey.USER_DETAIL_KEY, userDetail); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export function removeUserDetail() { | 
|---|
|  |  |  | return storageLocal.removeItem(StorageKey.USER_DETAIL_KEY); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | extraProps: { | 
|---|
|  |  |  | hide: (row: API.GetCheckReceiveTaskQueryResultItem) => | 
|---|
|  |  |  | row.checkReceiveStatus !== EnumTaskCheckReceiveStatus.WaitCheckReceive, | 
|---|
|  |  |  | row.checkReceiveStatus === EnumTaskCheckReceiveStatus.Completed, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const form = reactive({ | 
|---|
|  |  |  | name: '', | 
|---|
|  |  |  | billingMethod: EnumBillingMethod.Month, | 
|---|
|  |  |  | billingMethod: EnumBillingMethod.Day, | 
|---|
|  |  |  | serviceFee: null, | 
|---|
|  |  |  | settlementCycle: EnumSettlementCycle.Month, | 
|---|
|  |  |  | settlementCycle: EnumSettlementCycle.Day, | 
|---|
|  |  |  | benefits: [] as string[], | 
|---|
|  |  |  | ageMinLimit: null, | 
|---|
|  |  |  | ageMaxLimit: null, | 
|---|
|  |  |  | 
|---|
|  |  |  | </AppContainer> | 
|---|
|  |  |  | <UploadStatementDialog v-bind="dialogProps" /> | 
|---|
|  |  |  | <SettleDetailDialog v-bind="dialogSettleProps" /> | 
|---|
|  |  |  | <RechargeEnterpriseWalletDialog v-bind="dialogRechargeProps" /> | 
|---|
|  |  |  | </LoadingLayout> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | import { ModelValueType } from 'element-plus'; | 
|---|
|  |  |  | import UploadStatementDialog from './components/UploadStatementDialog.vue'; | 
|---|
|  |  |  | import SettleDetailDialog from './components/SettleDetailDialog.vue'; | 
|---|
|  |  |  | import RechargeEnterpriseWalletDialog from './components/RechargeEnterpriseWalletDialog.vue'; | 
|---|
|  |  |  | import { Message } from '@bole-core/core'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | defineOptions({ | 
|---|
|  |  |  | 
|---|
|  |  |  | ]); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const router = useRouter(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const { userDetail } = useUser(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const eventContext = useGlobalEventContext(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | let params: API.SureTaskSettlementCommand = { | 
|---|
|  |  |  | taskInfoId: settleEditForm.id, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | let res = await taskServices.sureTaskSettlement(params); | 
|---|
|  |  |  | let res = await taskServices.sureTaskSettlement(params, { | 
|---|
|  |  |  | skipErrorHandler: true, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | if (res) { | 
|---|
|  |  |  | Message.successMessage('操作成功'); | 
|---|
|  |  |  | getList(paginationState.pageIndex); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | } catch (error) { | 
|---|
|  |  |  | if (error?.info?.errorCode == 's510') { | 
|---|
|  |  |  | handleRechargeAdd(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const { | 
|---|
|  |  |  | dialogProps: dialogRechargeProps, | 
|---|
|  |  |  | handleAdd: handleRechargeAdd, | 
|---|
|  |  |  | editForm: rechargeEditForm, | 
|---|
|  |  |  | } = useFormDialog({ | 
|---|
|  |  |  | defaultFormParams: { | 
|---|
|  |  |  | access: EnumEnterpriseWalletAccess.Alipay, | 
|---|
|  |  |  | amount: null as number, | 
|---|
|  |  |  | remark: '', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function openSettleDialog(row: API.GetSettlementTasksQueryResultItem) { | 
|---|
|  |  |  | handleSettleEdit({ | 
|---|
|  |  |  | id: row.id, | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <ProDialog title="支付宝充值" v-model="visible" destroy-on-close draggable> | 
|---|
|  |  |  | <iframe v-if="form.alipayUrl" width="100%" height="600px" :src="form.alipayUrl"></iframe> | 
|---|
|  |  |  | </ProDialog> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script setup lang="ts"> | 
|---|
|  |  |  | import { ProDialog } from '@bole-core/components'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | defineOptions({ | 
|---|
|  |  |  | name: 'AlipayWalletRecharge', | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | type Form = { | 
|---|
|  |  |  | alipayUrl: string; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const form = defineModel<Form>('form'); | 
|---|
|  |  |  | const visible = defineModel({ type: Boolean }); | 
|---|
|  |  |  | </script> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <style lang="scss" scoped> | 
|---|
|  |  |  | @use '@/style/common.scss' as *; | 
|---|
|  |  |  | </style> | 
|---|
| New file | 
|  |  |  | 
|---|
|  |  |  | <template> | 
|---|
|  |  |  | <ProDialog | 
|---|
|  |  |  | title="钱包充值" | 
|---|
|  |  |  | v-model="visible" | 
|---|
|  |  |  | @close="onDialogClose" | 
|---|
|  |  |  | destroy-on-close | 
|---|
|  |  |  | draggable | 
|---|
|  |  |  | :width="700" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <ProForm :model="form" ref="dialogForm" label-width="120px"> | 
|---|
|  |  |  | <ProFormItemV2 label="钱包通道:" prop="access" :check-rules="[{ message: '请选择钱包通道' }]"> | 
|---|
|  |  |  | <ProFormSelect | 
|---|
|  |  |  | v-model="form.access" | 
|---|
|  |  |  | :valueEnum="EnumEnterpriseWalletAccessText" | 
|---|
|  |  |  | placeholder="请选择钱包通道" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | </ProFormSelect> | 
|---|
|  |  |  | </ProFormItemV2> | 
|---|
|  |  |  | <ProFormItemV2 | 
|---|
|  |  |  | label="充值金额:" | 
|---|
|  |  |  | prop="amount" | 
|---|
|  |  |  | :check-rules="[{ message: '请输入充值金额' }]" | 
|---|
|  |  |  | > | 
|---|
|  |  |  | <ProFormInputNumber | 
|---|
|  |  |  | placeholder="请输入充值金额" | 
|---|
|  |  |  | v-model.trim="form.amount" | 
|---|
|  |  |  | :controls="false" | 
|---|
|  |  |  | :min="0" | 
|---|
|  |  |  | ></ProFormInputNumber> | 
|---|
|  |  |  | </ProFormItemV2> | 
|---|
|  |  |  | <ProFormItemV2 label="备注" prop="remark"> | 
|---|
|  |  |  | <ProFormTextArea placeholder="请输入备注" v-model="form.remark"></ProFormTextArea> | 
|---|
|  |  |  | </ProFormItemV2> | 
|---|
|  |  |  | </ProForm> | 
|---|
|  |  |  | <template #footer> | 
|---|
|  |  |  | <span class="dialog-footer"> | 
|---|
|  |  |  | <el-button @click="emit('onCancel')">取消</el-button> | 
|---|
|  |  |  | <el-button type="primary" @click="handleConfirm">确认</el-button> | 
|---|
|  |  |  | </span> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  | </ProDialog> | 
|---|
|  |  |  | <AlipayWalletRecharge v-bind="dialogAlipayWalletProps" /> | 
|---|
|  |  |  | </template> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <script setup lang="ts"> | 
|---|
|  |  |  | import { FormInstance } from 'element-plus'; | 
|---|
|  |  |  | import { | 
|---|
|  |  |  | ProDialog, | 
|---|
|  |  |  | ProForm, | 
|---|
|  |  |  | ProFormInputNumber, | 
|---|
|  |  |  | ProFormItemV2, | 
|---|
|  |  |  | ProFormTextArea, | 
|---|
|  |  |  | useFormDialog, | 
|---|
|  |  |  | ProFormSelect, | 
|---|
|  |  |  | } from '@bole-core/components'; | 
|---|
|  |  |  | import * as enterpriseWalletServices from '@/services/api/enterpriseWallet'; | 
|---|
|  |  |  | import AlipayWalletRecharge from './AlipayWalletRecharge.vue'; | 
|---|
|  |  |  | import { EnumEnterpriseWalletAccessText } from '@/constants'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | defineOptions({ | 
|---|
|  |  |  | name: 'RechargeEnterpriseWalletDialog', | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | type Form = { | 
|---|
|  |  |  | title?: string; | 
|---|
|  |  |  | amount: number; | 
|---|
|  |  |  | remark: string; | 
|---|
|  |  |  | access: EnumEnterpriseWalletAccess; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const visible = defineModel({ type: Boolean }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const form = defineModel<Form>('form'); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const emit = defineEmits<{ | 
|---|
|  |  |  | (e: 'onConfirm'): void; | 
|---|
|  |  |  | (e: 'onCancel'): void; | 
|---|
|  |  |  | }>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const dialogForm = ref<FormInstance>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const { dialogProps: dialogAlipayWalletProps, handleAdd: handleAlipayWalletAdd } = useFormDialog({ | 
|---|
|  |  |  | defaultFormParams: { | 
|---|
|  |  |  | alipayUrl: '', | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | async function rechargeEnterpriseWallet() { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | let params: API.RechargeEnterpriseWalletCommand = { | 
|---|
|  |  |  | access: form.value.access, | 
|---|
|  |  |  | amount: form.value.amount, | 
|---|
|  |  |  | remark: form.value.remark, | 
|---|
|  |  |  | }; | 
|---|
|  |  |  | let res = await enterpriseWalletServices.rechargeEnterpriseWallet(params); | 
|---|
|  |  |  | if (res) { | 
|---|
|  |  |  | handleAlipayWalletAdd({ | 
|---|
|  |  |  | alipayUrl: res.payUrl, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (error) {} | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function onDialogClose() { | 
|---|
|  |  |  | if (!dialogForm.value) return; | 
|---|
|  |  |  | dialogForm.value.resetFields(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | function handleConfirm() { | 
|---|
|  |  |  | if (!dialogForm.value) return; | 
|---|
|  |  |  | dialogForm.value.validate((valid) => { | 
|---|
|  |  |  | if (valid) { | 
|---|
|  |  |  | rechargeEnterpriseWallet(); | 
|---|
|  |  |  | emit('onConfirm'); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | </script> | 
|---|