Merge remote-tracking branch 'yudao/dev' into dev
						commit
						b6d2cc6c65
					
				|  | @ -10,7 +10,12 @@ import { | |||
|   setupVbenVxeTable, | ||||
|   useVbenVxeGrid, | ||||
| } from '@vben/plugins/vxe-table'; | ||||
| import { isFunction, isString } from '@vben/utils'; | ||||
| import { | ||||
|   floatToFixed2, | ||||
|   formatToFractionDigit, | ||||
|   isFunction, | ||||
|   isString, | ||||
| } from '@vben/utils'; | ||||
| 
 | ||||
| import { Button, Image, Popconfirm, Switch } from 'ant-design-vue'; | ||||
| 
 | ||||
|  | @ -313,33 +318,13 @@ setupVbenVxeTable({ | |||
|     // add by 星语:数量格式化,例如说:金额
 | ||||
|     vxeUI.formats.add('formatNumber', { | ||||
|       tableCellFormatMethod({ cellValue }, digits = 2) { | ||||
|         if (cellValue === null || cellValue === undefined) { | ||||
|           return ''; | ||||
|         } | ||||
|         if (isString(cellValue)) { | ||||
|           cellValue = Number.parseFloat(cellValue); | ||||
|         } | ||||
|         // 如果非 number,则直接返回空串
 | ||||
|         if (Number.isNaN(cellValue)) { | ||||
|           return ''; | ||||
|         } | ||||
|         return cellValue.toFixed(digits); | ||||
|         return formatToFractionDigit(cellValue, digits); | ||||
|       }, | ||||
|     }); | ||||
| 
 | ||||
|     vxeUI.formats.add('formatAmount2', { | ||||
|       tableCellFormatMethod({ cellValue }) { | ||||
|         if (cellValue === null || cellValue === undefined) { | ||||
|           return '0.00'; | ||||
|         } | ||||
|         if (isString(cellValue)) { | ||||
|           cellValue = Number.parseFloat(cellValue); | ||||
|         } | ||||
|         // 如果非 number,则直接返回空串
 | ||||
|         if (Number.isNaN(cellValue)) { | ||||
|           return '0.00'; | ||||
|         } | ||||
|         return `${(cellValue / 100).toFixed(2)}元`; | ||||
|         return `${floatToFixed2(cellValue)}元`; | ||||
|       }, | ||||
|     }); | ||||
|   }, | ||||
|  |  | |||
|  | @ -25,7 +25,7 @@ import { | |||
|   Tooltip, | ||||
| } from 'ant-design-vue'; | ||||
| 
 | ||||
| import { BpmModelFormType } from '#/utils/constants'; | ||||
| import { BpmModelFormType } from '#/utils'; | ||||
| 
 | ||||
| import { | ||||
|   COMPARISON_OPERATORS, | ||||
|  |  | |||
|  | @ -1,7 +1,6 @@ | |||
| export * from './constants'; | ||||
| export * from './dict'; | ||||
| export * from './download'; | ||||
| export * from './formatNumber'; | ||||
| export * from './formCreate'; | ||||
| export * from './rangePickerProps'; | ||||
| export * from './routerHelper'; | ||||
|  |  | |||
|  | @ -4,14 +4,13 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; | |||
| import { onMounted } from 'vue'; | ||||
| import { useRoute, useRouter } from 'vue-router'; | ||||
| 
 | ||||
| import { Page, useVbenModal } from '@vben/common-ui'; | ||||
| import { DocAlert, Page, useVbenModal } from '@vben/common-ui'; | ||||
| 
 | ||||
| import { Button, Image, Tag, Tooltip } from 'ant-design-vue'; | ||||
| 
 | ||||
| import { TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; | ||||
| import { getProcessDefinitionPage } from '#/api/bpm/definition'; | ||||
| import { DocAlert } from '#/components/doc-alert'; | ||||
| import { BpmModelFormType } from '#/utils/constants'; | ||||
| import { BpmModelFormType } from '#/utils'; | ||||
| 
 | ||||
| // 导入 FormCreate 表单详情 | ||||
| import FormCreateDetail from '../../form/modules/detail.vue'; | ||||
|  |  | |||
|  | @ -26,8 +26,11 @@ import { | |||
|   HttpRequestSetting, | ||||
|   parseFormFields, | ||||
| } from '#/components/simple-process-design'; | ||||
| import { ProcessVariableEnum } from '#/utils'; | ||||
| import { BpmAutoApproveType, BpmModelFormType } from '#/utils/constants'; | ||||
| import { | ||||
|   BpmAutoApproveType, | ||||
|   BpmModelFormType, | ||||
|   ProcessVariableEnum, | ||||
| } from '#/utils'; | ||||
| 
 | ||||
| const modelData = defineModel<any>(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -167,7 +167,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { | |||
|     { | ||||
|       field: 'totalPrice', | ||||
|       title: '商机金额(元)', | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       field: 'dealTime', | ||||
|  |  | |||
|  | @ -1,9 +1,7 @@ | |||
| import type { VxeTableGridOptions } from '#/adapter/vxe-table'; | ||||
| import type { DescriptionItemSchema } from '#/components/description'; | ||||
| 
 | ||||
| import { formatDateTime } from '@vben/utils'; | ||||
| 
 | ||||
| import { erpPriceInputFormatter } from '#/utils'; | ||||
| import { erpPriceInputFormatter, formatDateTime } from '@vben/utils'; | ||||
| 
 | ||||
| /** 详情页的字段 */ | ||||
| export function useDetailSchema(): DescriptionItemSchema[] { | ||||
|  | @ -97,7 +95,7 @@ export function useDetailListColumns(): VxeTableGridOptions['columns'] { | |||
|     { | ||||
|       field: 'totalPrice', | ||||
|       title: '商机金额(元)', | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       field: 'dealTime', | ||||
|  |  | |||
|  | @ -6,8 +6,7 @@ import { getSimpleBusinessList } from '#/api/crm/business'; | |||
| import { getSimpleContactList } from '#/api/crm/contact'; | ||||
| import { getCustomerSimpleList } from '#/api/crm/customer'; | ||||
| import { getSimpleUserList } from '#/api/system/user'; | ||||
| import { erpPriceMultiply, floatToFixed2 } from '#/utils'; | ||||
| import { DICT_TYPE } from '#/utils/dict'; | ||||
| import { DICT_TYPE, erpPriceMultiply, floatToFixed2 } from '#/utils'; | ||||
| 
 | ||||
| /** 新增/修改的表单 */ | ||||
| export function useFormSchema(): VbenFormSchema[] { | ||||
|  | @ -242,7 +241,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { | |||
|       title: '合同金额(元)', | ||||
|       field: 'totalPrice', | ||||
|       minWidth: 150, | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       title: '下单时间', | ||||
|  | @ -277,7 +276,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { | |||
|       title: '已回款金额(元)', | ||||
|       field: 'totalReceivablePrice', | ||||
|       minWidth: 150, | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       title: '未回款金额(元)', | ||||
|  |  | |||
|  | @ -120,7 +120,7 @@ export function useDetailListColumns(): VxeTableGridOptions['columns'] { | |||
|       title: '合同金额(元)', | ||||
|       field: 'totalPrice', | ||||
|       minWidth: 150, | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       title: '合同开始时间', | ||||
|  | @ -138,7 +138,7 @@ export function useDetailListColumns(): VxeTableGridOptions['columns'] { | |||
|       title: '已回款金额(元)', | ||||
|       field: 'totalReceivablePrice', | ||||
|       minWidth: 150, | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       title: '未回款金额(元)', | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import type { VbenFormSchema } from '#/adapter/form'; | ||||
| import type { VxeTableGridOptions } from '#/adapter/vxe-table'; | ||||
| 
 | ||||
| import { DICT_TYPE, getDictOptions } from '#/utils/dict'; | ||||
| import { DICT_TYPE, getDictOptions } from '#/utils'; | ||||
| 
 | ||||
| /** 列表的搜索表单 */ | ||||
| export function useGridFormSchema(): VbenFormSchema[] { | ||||
|  |  | |||
|  | @ -134,7 +134,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { | |||
|     { | ||||
|       field: 'price', | ||||
|       title: '价格(元)', | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       field: 'description', | ||||
|  | @ -203,7 +203,7 @@ export function useProductEditTableColumns(): VxeTableGridOptions['columns'] { | |||
|       field: 'productPrice', | ||||
|       title: '价格(元)', | ||||
|       minWidth: 100, | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       field: 'sellingPrice', | ||||
|  | @ -221,7 +221,7 @@ export function useProductEditTableColumns(): VxeTableGridOptions['columns'] { | |||
|       field: 'totalPrice', | ||||
|       title: '合计', | ||||
|       minWidth: 100, | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       title: '操作', | ||||
|  |  | |||
|  | @ -94,12 +94,12 @@ export function useDetailListColumns( | |||
|     { | ||||
|       field: 'productPrice', | ||||
|       title: '产品价格(元)', | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       field: 'businessPrice', | ||||
|       title: '商机价格(元)', | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|       visible: showBussinePrice, | ||||
|     }, | ||||
|     { | ||||
|  | @ -110,7 +110,7 @@ export function useDetailListColumns( | |||
|     { | ||||
|       field: 'totalPrice', | ||||
|       title: '合计金额(元)', | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|   ]; | ||||
| } | ||||
|  |  | |||
|  | @ -5,7 +5,7 @@ import { getContractSimpleList } from '#/api/crm/contract'; | |||
| import { getCustomerSimpleList } from '#/api/crm/customer'; | ||||
| import { getReceivablePlanSimpleList } from '#/api/crm/receivable/plan'; | ||||
| import { getSimpleUserList } from '#/api/system/user'; | ||||
| import { DICT_TYPE, getDictOptions } from '#/utils/dict'; | ||||
| import { DICT_TYPE, getDictOptions } from '#/utils'; | ||||
| 
 | ||||
| /** 新增/修改的表单 */ | ||||
| export function useFormSchema(): VbenFormSchema[] { | ||||
|  | @ -199,7 +199,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { | |||
|       title: '回款金额(元)', | ||||
|       field: 'price', | ||||
|       minWidth: 150, | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       title: '回款方式', | ||||
|  | @ -219,7 +219,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { | |||
|       title: '合同金额(元)', | ||||
|       field: 'contract.totalPrice', | ||||
|       minWidth: 150, | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       title: '负责人', | ||||
|  |  | |||
|  | @ -3,10 +3,10 @@ import type { DescriptionItemSchema } from '#/components/description'; | |||
| 
 | ||||
| import { h } from 'vue'; | ||||
| 
 | ||||
| import { formatDateTime } from '@vben/utils'; | ||||
| import { erpPriceInputFormatter, formatDateTime } from '@vben/utils'; | ||||
| 
 | ||||
| import { DictTag } from '#/components/dict-tag'; | ||||
| import { DICT_TYPE, erpPriceInputFormatter } from '#/utils'; | ||||
| import { DICT_TYPE } from '#/utils'; | ||||
| 
 | ||||
| /** 详情页的字段 */ | ||||
| export function useDetailSchema(): DescriptionItemSchema[] { | ||||
|  | @ -108,7 +108,7 @@ export function useDetailListColumns(): VxeTableGridOptions['columns'] { | |||
|       title: '回款金额(元)', | ||||
|       field: 'price', | ||||
|       minWidth: 150, | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       title: '回款方式', | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ import type { VbenFormSchema } from '#/adapter/form'; | |||
| import type { VxeTableGridOptions } from '#/adapter/vxe-table'; | ||||
| 
 | ||||
| import { getCustomerSimpleList } from '#/api/crm/customer'; | ||||
| import { DICT_TYPE, getDictOptions } from '#/utils/dict'; | ||||
| import { DICT_TYPE, floatToFixed2, getDictOptions } from '#/utils'; | ||||
| 
 | ||||
| /** 新增/修改的表单 */ | ||||
| export function useFormSchema(): VbenFormSchema[] { | ||||
|  | @ -141,7 +141,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { | |||
|       title: '计划回款金额(元)', | ||||
|       field: 'price', | ||||
|       minWidth: 160, | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       title: '计划回款日期', | ||||
|  | @ -183,7 +183,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { | |||
|       title: '实际回款金额(元)', | ||||
|       field: 'receivable.price', | ||||
|       minWidth: 160, | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       title: '实际回款日期', | ||||
|  | @ -197,9 +197,9 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { | |||
|       minWidth: 160, | ||||
|       formatter: ({ row }) => { | ||||
|         if (row.receivable) { | ||||
|           return row.price - row.receivable.price; | ||||
|           return floatToFixed2(row.price - row.receivable.price); | ||||
|         } | ||||
|         return row.price; | ||||
|         return floatToFixed2(row.price); | ||||
|       }, | ||||
|     }, | ||||
|     { | ||||
|  |  | |||
|  | @ -3,10 +3,10 @@ import type { DescriptionItemSchema } from '#/components/description'; | |||
| 
 | ||||
| import { h } from 'vue'; | ||||
| 
 | ||||
| import { formatDateTime } from '@vben/utils'; | ||||
| import { erpPriceInputFormatter, formatDateTime } from '@vben/utils'; | ||||
| 
 | ||||
| import { DictTag } from '#/components/dict-tag'; | ||||
| import { DICT_TYPE, erpPriceInputFormatter } from '#/utils'; | ||||
| import { DICT_TYPE } from '#/utils'; | ||||
| 
 | ||||
| /** 详情页的字段 */ | ||||
| export function useDetailSchema(): DescriptionItemSchema[] { | ||||
|  | @ -101,7 +101,7 @@ export function useDetailListColumns(): VxeTableGridOptions['columns'] { | |||
|       title: '计划回款(元)', | ||||
|       field: 'price', | ||||
|       minWidth: 150, | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       title: '计划回款日期', | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ import { useRouter } from 'vue-router'; | |||
| import { confirm, DocAlert, Page } from '@vben/common-ui'; | ||||
| import { | ||||
|   downloadFileFromBlobPart, | ||||
|   fenToYuan, | ||||
|   handleTree, | ||||
|   treeToString, | ||||
| } from '@vben/utils'; | ||||
|  | @ -24,7 +25,7 @@ import { | |||
|   updateStatus, | ||||
| } from '#/api/mall/product/spu'; | ||||
| import { $t } from '#/locales'; | ||||
| import { fenToYuan, ProductSpuStatusEnum } from '#/utils'; | ||||
| import { ProductSpuStatusEnum } from '#/utils'; | ||||
| 
 | ||||
| import { useGridColumns, useGridFormSchema } from './data'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ import type { MallOrderApi } from '#/api/mall/trade/order'; | |||
| import { h, onMounted, ref } from 'vue'; | ||||
| 
 | ||||
| import { Page, prompt } from '@vben/common-ui'; | ||||
| import { fenToYuan } from '@vben/utils'; | ||||
| 
 | ||||
| import { Card, Input, message } from 'ant-design-vue'; | ||||
| 
 | ||||
|  | @ -15,7 +16,7 @@ import { | |||
|   getOrderSummary, | ||||
| } from '#/api/mall/trade/order'; | ||||
| import { SummaryCard } from '#/components/summary-card'; | ||||
| import { DeliveryTypeEnum, fenToYuan, TradeOrderStatusEnum } from '#/utils'; | ||||
| import { DeliveryTypeEnum, TradeOrderStatusEnum } from '#/utils'; | ||||
| 
 | ||||
| import { useGridColumns, useGridFormSchema } from './data'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ import { h } from 'vue'; | |||
| import { useRouter } from 'vue-router'; | ||||
| 
 | ||||
| import { DocAlert, Page, prompt, useVbenModal } from '@vben/common-ui'; | ||||
| import { fenToYuan } from '@vben/utils'; | ||||
| 
 | ||||
| import { Image, List, Tag, Textarea } from 'ant-design-vue'; | ||||
| 
 | ||||
|  | @ -13,12 +14,7 @@ import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; | |||
| import { getOrderPage, updateOrderRemark } from '#/api/mall/trade/order'; | ||||
| import { DictTag } from '#/components/dict-tag'; | ||||
| import { $t } from '#/locales'; | ||||
| import { | ||||
|   DeliveryTypeEnum, | ||||
|   DICT_TYPE, | ||||
|   fenToYuan, | ||||
|   TradeOrderStatusEnum, | ||||
| } from '#/utils'; | ||||
| import { DeliveryTypeEnum, DICT_TYPE, TradeOrderStatusEnum } from '#/utils'; | ||||
| 
 | ||||
| import { useGridColumns, useGridFormSchema } from './data'; | ||||
| import DeleveryForm from './modules/delevery-form.vue'; | ||||
|  |  | |||
|  | @ -2,10 +2,11 @@ | |||
| import type { MemberUserApi } from '#/api/member/user'; | ||||
| import type { PayWalletApi } from '#/api/pay/wallet/balance'; | ||||
| 
 | ||||
| import { fenToYuan } from '@vben/utils'; | ||||
| 
 | ||||
| import { Card } from 'ant-design-vue'; | ||||
| 
 | ||||
| import { useDescription } from '#/components/description'; | ||||
| import { fenToYuan } from '#/utils'; | ||||
| 
 | ||||
| withDefaults( | ||||
|   defineProps<{ | ||||
|  |  | |||
|  | @ -3,6 +3,8 @@ import type { VxeTableGridOptions } from '#/adapter/vxe-table'; | |||
| 
 | ||||
| import { h } from 'vue'; | ||||
| 
 | ||||
| import { convertToInteger, formatToFraction } from '@vben/utils'; | ||||
| 
 | ||||
| import { Tag } from 'ant-design-vue'; | ||||
| 
 | ||||
| import { z } from '#/adapter/form'; | ||||
|  | @ -12,9 +14,7 @@ import { getSimpleTagList } from '#/api/member/tag'; | |||
| import { getAreaTree } from '#/api/system/area'; | ||||
| import { | ||||
|   CommonStatusEnum, | ||||
|   convertToInteger, | ||||
|   DICT_TYPE, | ||||
|   formatToFraction, | ||||
|   getDictOptions, | ||||
|   getRangePickerDefaultProps, | ||||
| } from '#/utils'; | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ import type { MemberUserApi } from '#/api/member/user'; | |||
| import { ref } from 'vue'; | ||||
| 
 | ||||
| import { useVbenModal } from '@vben/common-ui'; | ||||
| import { formatToFraction } from '@vben/utils'; | ||||
| 
 | ||||
| import { message } from 'ant-design-vue'; | ||||
| 
 | ||||
|  | @ -11,7 +12,6 @@ import { useVbenForm } from '#/adapter/form'; | |||
| import { getUser, updateUser } from '#/api/member/user'; | ||||
| import { getWallet } from '#/api/pay/wallet/balance'; | ||||
| import { $t } from '#/locales'; | ||||
| import { formatToFraction } from '#/utils'; | ||||
| 
 | ||||
| import { useBalanceFormSchema } from '../data'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -2,8 +2,7 @@ import type { VbenFormSchema } from '#/adapter/form'; | |||
| import type { VxeTableGridOptions } from '#/adapter/vxe-table'; | ||||
| import type { PayAppApi } from '#/api/pay/app'; | ||||
| 
 | ||||
| import { CommonStatusEnum } from '#/utils/constants'; | ||||
| import { DICT_TYPE, getDictOptions } from '#/utils/dict'; | ||||
| import { CommonStatusEnum, DICT_TYPE, getDictOptions } from '#/utils'; | ||||
| 
 | ||||
| export function useGridFormSchema(): VbenFormSchema[] { | ||||
|   return [ | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ import { message } from 'ant-design-vue'; | |||
| import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table'; | ||||
| import { changeAppStatus, deleteApp, getAppPage } from '#/api/pay/app'; | ||||
| import { $t } from '#/locales'; | ||||
| import { CommonStatusEnum, PayChannelEnum } from '#/utils/constants'; | ||||
| import { CommonStatusEnum, PayChannelEnum } from '#/utils'; | ||||
| 
 | ||||
| import { useGridColumns, useGridFormSchema } from './data'; | ||||
| import appFrom from './modules/app-form.vue'; | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ import type { VbenFormSchema } from '#/adapter/form'; | |||
| import { h } from 'vue'; | ||||
| 
 | ||||
| import { InputUpload } from '#/components/upload'; | ||||
| import { DICT_TYPE, getDictOptions } from '#/utils/dict'; | ||||
| import { DICT_TYPE, getDictOptions } from '#/utils'; | ||||
| 
 | ||||
| export function channelSchema(formType: string): VbenFormSchema[] { | ||||
|   if (formType.includes('alipay_')) { | ||||
|  |  | |||
|  | @ -6,7 +6,7 @@ import { useRoute, useRouter } from 'vue-router'; | |||
| 
 | ||||
| import { Page, useVbenModal } from '@vben/common-ui'; | ||||
| import { useTabs } from '@vben/hooks'; | ||||
| import { formatDate } from '@vben/utils'; | ||||
| import { fenToYuan, formatDate } from '@vben/utils'; | ||||
| 
 | ||||
| import { | ||||
|   Button, | ||||
|  | @ -19,7 +19,6 @@ import { | |||
| 
 | ||||
| import { getOrder, submitOrder } from '#/api/pay/order'; | ||||
| import { | ||||
|   fenToYuan, | ||||
|   PayChannelEnum, | ||||
|   PayDisplayModeEnum, | ||||
|   PayOrderStatusEnum, | ||||
|  |  | |||
|  | @ -50,12 +50,12 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { | |||
|     { | ||||
|       field: 'price', | ||||
|       title: '支付价格', | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       field: 'refundPrice', | ||||
|       title: '退款金额', | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       field: 'createTime', | ||||
|  |  | |||
|  | @ -78,7 +78,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { | |||
|     { | ||||
|       field: 'price', | ||||
|       title: '提现金额', | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       field: 'userName', | ||||
|  |  | |||
|  | @ -12,6 +12,7 @@ import { | |||
|   transferDemoWithdraw, | ||||
| } from '#/api/pay/demo/withdraw'; | ||||
| import { $t } from '#/locales'; | ||||
| import { floatToFixed2 } from '#/utils'; | ||||
| 
 | ||||
| import { useGridColumns } from './data'; | ||||
| import Form from './modules/form.vue'; | ||||
|  | @ -109,7 +110,7 @@ const [Grid, gridApi] = useVbenVxeGrid({ | |||
|         <Tag v-else-if="row.type === 3">钱包余额</Tag> | ||||
|       </template> | ||||
|       <template #price="{ row }"> | ||||
|         <span>¥{{ (row.price / 100.0).toFixed(2) }}</span> | ||||
|         <span>¥{{ floatToFixed2(row.price) }}</span> | ||||
|       </template> | ||||
|       <template #status="{ row }"> | ||||
|         <Tag v-if="row.status === 0 && !row.payTransferId" type="warning"> | ||||
|  |  | |||
|  | @ -78,17 +78,17 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { | |||
|     { | ||||
|       title: '支付金额', | ||||
|       field: 'price', | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       title: '退款金额', | ||||
|       field: 'refundPrice', | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       title: '手续金额', | ||||
|       field: 'channelFeePrice', | ||||
|       formatter: 'formatNumber', | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       title: '订单号', | ||||
|  |  | |||
|  | @ -10,7 +10,7 @@ import { Descriptions, Divider, Tag } from 'ant-design-vue'; | |||
| 
 | ||||
| import { getOrder } from '#/api/pay/order'; | ||||
| import { DictTag } from '#/components/dict-tag'; | ||||
| import { DICT_TYPE } from '#/utils/dict'; | ||||
| import { DICT_TYPE, floatToFixed2 } from '#/utils'; | ||||
| 
 | ||||
| const detailData = ref<PayOrderApi.Order>(); | ||||
| 
 | ||||
|  | @ -63,16 +63,16 @@ const [Modal, modalApi] = useVbenModal({ | |||
|       </Descriptions.Item> | ||||
|       <Descriptions.Item label="支付金额"> | ||||
|         <Tag color="green" size="small"> | ||||
|           ¥{{ (detailData?.price || 0 / 100.0).toFixed(2) }} | ||||
|           ¥{{ floatToFixed2(detailData?.price) }} | ||||
|         </Tag> | ||||
|       </Descriptions.Item> | ||||
|       <Descriptions.Item label="手续费"> | ||||
|         <Tag color="orange" size="small"> | ||||
|           ¥{{ (detailData?.channelFeePrice || 0 / 100.0).toFixed(2) }} | ||||
|           ¥{{ floatToFixed2(detailData?.channelFeePrice) }} | ||||
|         </Tag> | ||||
|       </Descriptions.Item> | ||||
|       <Descriptions.Item label="手续费比例"> | ||||
|         {{ (detailData?.channelFeeRate || 0 / 100.0).toFixed(2) }}% | ||||
|         {{ floatToFixed2(detailData?.channelFeeRate) }}% | ||||
|       </Descriptions.Item> | ||||
|       <Descriptions.Item label="支付时间"> | ||||
|         {{ formatDateTime(detailData?.successTime) }} | ||||
|  | @ -115,7 +115,7 @@ const [Modal, modalApi] = useVbenModal({ | |||
|       </Descriptions.Item> | ||||
|       <Descriptions.Item label="退款金额" :span="2"> | ||||
|         <Tag size="small" color="red"> | ||||
|           ¥{{ (detailData?.refundPrice || 0 / 100.0).toFixed(2) }} | ||||
|           ¥{{ floatToFixed2(detailData?.refundPrice) }} | ||||
|         </Tag> | ||||
|       </Descriptions.Item> | ||||
|       <Descriptions.Item label="通知 URL"> | ||||
|  |  | |||
|  | @ -9,7 +9,12 @@ import { formatDateTime } from '@vben/utils'; | |||
| import { Tag } from 'ant-design-vue'; | ||||
| 
 | ||||
| import { DictTag } from '#/components/dict-tag'; | ||||
| import { DICT_TYPE, getDictOptions, getRangePickerDefaultProps } from '#/utils'; | ||||
| import { | ||||
|   DICT_TYPE, | ||||
|   floatToFixed2, | ||||
|   getDictOptions, | ||||
|   getRangePickerDefaultProps, | ||||
| } from '#/utils'; | ||||
| 
 | ||||
| /** 列表的搜索表单 */ | ||||
| export function useGridFormSchema(): VbenFormSchema[] { | ||||
|  | @ -120,7 +125,7 @@ export function useGridColumns(): VxeTableGridOptions['columns'] { | |||
|     { | ||||
|       field: 'price', | ||||
|       title: '转账金额', | ||||
|       formatter: ({ cellValue }) => `¥${(cellValue / 100).toFixed(2)}`, | ||||
|       formatter: 'formatAmount2', | ||||
|     }, | ||||
|     { | ||||
|       field: 'status', | ||||
|  | @ -217,7 +222,7 @@ export function useDetailSchema(): DescriptionItemSchema[] { | |||
|       content: (data) => { | ||||
|         return h(Tag, { | ||||
|           color: 'blue', | ||||
|           content: `¥${(data?.price / 100).toFixed(2)}`, | ||||
|           content: `¥${floatToFixed2(data?.price)}`, | ||||
|         }); | ||||
|       }, | ||||
|     }, | ||||
|  |  | |||
|  | @ -4,6 +4,7 @@ import type { WalletRechargePackageApi } from '#/api/pay/wallet/rechargePackage' | |||
| import { computed, ref } from 'vue'; | ||||
| 
 | ||||
| import { useVbenModal } from '@vben/common-ui'; | ||||
| import { fenToYuan, yuanToFen } from '@vben/utils'; | ||||
| 
 | ||||
| import { message } from 'ant-design-vue'; | ||||
| 
 | ||||
|  | @ -14,7 +15,6 @@ import { | |||
|   updatePackage, | ||||
| } from '#/api/pay/wallet/rechargePackage'; | ||||
| import { $t } from '#/locales'; | ||||
| import { fenToYuan, yuanToFen } from '#/utils'; | ||||
| 
 | ||||
| import { useFormSchema } from '../data'; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,12 +1,25 @@ | |||
| // TODO @xingyu:感觉 formatToFraction 可以整合起来;【优先级:低】
 | ||||
| import { isEmpty, isString, isUndefined } from './inference'; | ||||
| 
 | ||||
| /** | ||||
|  * 将一个整数转换为分数保留传入的小数 | ||||
|  * @param num | ||||
|  * @param digit | ||||
|  */ | ||||
| export function formatToFractionDigit( | ||||
|   num: number | string | undefined, | ||||
|   digit: number = 2, | ||||
| ): string { | ||||
|   if (isUndefined(num)) return '0.00'; | ||||
|   const parsedNumber = isString(num) ? Number.parseFloat(num) : num; | ||||
|   return (parsedNumber / 100).toFixed(digit); | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  * 将一个整数转换为分数保留两位小数 | ||||
|  * @param num | ||||
|  */ | ||||
| export function formatToFraction(num: number | string | undefined): string { | ||||
|   if (num === undefined) return '0.00'; | ||||
|   const parsedNumber = typeof num === 'string' ? Number.parseFloat(num) : num; | ||||
|   return (parsedNumber / 100).toFixed(2); | ||||
|   return formatToFractionDigit(num, 2); | ||||
| } | ||||
| 
 | ||||
| /** | ||||
|  | @ -17,9 +30,7 @@ export function formatToFraction(num: number | string | undefined): string { | |||
|  */ | ||||
| export function floatToFixed2(num: number | string | undefined): string { | ||||
|   let str = '0.00'; | ||||
|   if (num === undefined) { | ||||
|     return str; | ||||
|   } | ||||
|   if (isUndefined(num)) return str; | ||||
|   const f = formatToFraction(num); | ||||
|   const decimalPart = f.toString().split('.')[1]; | ||||
|   const len = decimalPart ? decimalPart.length : 0; | ||||
|  | @ -45,8 +56,8 @@ export function floatToFixed2(num: number | string | undefined): string { | |||
|  * @param num | ||||
|  */ | ||||
| export function convertToInteger(num: number | string | undefined): number { | ||||
|   if (num === undefined) return 0; | ||||
|   const parsedNumber = typeof num === 'string' ? Number.parseFloat(num) : num; | ||||
|   if (isUndefined(num)) return 0; | ||||
|   const parsedNumber = isString(num) ? Number.parseFloat(num) : num; | ||||
|   return Math.round(parsedNumber * 100); | ||||
| } | ||||
| 
 | ||||
|  | @ -125,7 +136,6 @@ export function erpCountInputFormatter(num: number | string | undefined) { | |||
|   return erpNumberFormatter(num, ERP_COUNT_DIGIT); | ||||
| } | ||||
| 
 | ||||
| // noinspection JSCommentMatchesSignature
 | ||||
| /** | ||||
|  * 【ERP】格式化数量,保留三位小数 | ||||
|  * | ||||
|  | @ -148,7 +158,6 @@ export function erpPriceInputFormatter(num: number | string | undefined) { | |||
|   return erpNumberFormatter(num, ERP_PRICE_DIGIT); | ||||
| } | ||||
| 
 | ||||
| // noinspection JSCommentMatchesSignature
 | ||||
| /** | ||||
|  * 【ERP】格式化金额,保留二位小数 | ||||
|  * | ||||
|  | @ -167,9 +176,7 @@ export function erpPriceTableColumnFormatter(cellValue: any) { | |||
|  * @return 总价格。如果有任一为空,则返回 undefined | ||||
|  */ | ||||
| export function erpPriceMultiply(price: number, count: number) { | ||||
|   if (price === null || count === null) { | ||||
|     return undefined; | ||||
|   } | ||||
|   if (isEmpty(price) || isEmpty(count)) return undefined; | ||||
|   return Number.parseFloat((price * count).toFixed(ERP_PRICE_DIGIT)); | ||||
| } | ||||
| 
 | ||||
|  | @ -3,6 +3,7 @@ export * from './date'; | |||
| export * from './diff'; | ||||
| export * from './dom'; | ||||
| export * from './download'; | ||||
| export * from './formatNumber'; | ||||
| export * from './inference'; | ||||
| export * from './letter'; | ||||
| export * from './merge'; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 jason
						jason