Otsuka-APP/utils/utils.js
2026-02-13 13:51:37 +08:00

34 lines
884 B
JavaScript

// 格式化价格,保留两位小数
export const formatPrice = (value) => {
if (!value && value !== 0) return '0.00'
return Number(value).toFixed(2)
}
import { securityFileDownload } from '@/api/FileUpload/FileUpload.js';
export const YuLanfile = async (filePath) => {
if (!filePath) {
uni.showToast({ title: '文件路径不存在', icon: 'none' })
return
}
try {
uni.showLoading({ title: '加载中...', mask: true })
const response = await securityFileDownload({
fileName: filePath,
delete: false
})
console.log('返回数据:', response);
} catch (error) {
console.error('文件下载失败:', error);
uni.showToast({ title: '文件加载失败', icon: 'none' })
} finally {
uni.hideLoading()
}
}