Otsuka-APP/utils/utils.js

34 lines
884 B
JavaScript
Raw Normal View History

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