完善销售订单, 添加订单排序页

This commit is contained in:
zhengw
2026-01-28 17:18:43 +08:00
parent af7928d39d
commit 8960c8ea73
18 changed files with 697 additions and 60 deletions

View File

@@ -1,4 +1,5 @@
import { http } from './config';
import Big from 'big.js';
export const formatTime = (date: Date) => {
const year = date.getFullYear();
@@ -19,12 +20,11 @@ export const formatNumber = (n: number | string) => {
};
// 对话框
export const showModal = (title: string, content: string, showCancel = false) => {
export const showModal = (option: { title?: string; content: string }) => {
return new Promise<void>((resolve, reject) => {
wx.showModal({
title,
content,
showCancel,
title: option.title || '系统提示',
content: option.content,
success(res) {
if (res.confirm) {
resolve();
@@ -306,3 +306,44 @@ export const getCurrentPageRoute = () => {
const currentPage = pages[pages.length - 1]; // 获取当前页面对象
return `/${currentPage.route}`; // 获取当前页面路径
};
/** 价格保留位数 */
export const priceRetentionDigits = (value?: number) => {
return toNumber(
Big(toNumber(value)).toFixed(toNumber(wx.getStorageSync('PRICE_HOLD_POINT') || 2)),
);
};
/** 价格保留位数字符串类型 */
export const priceRetentionDigitsString = (value?: number) => {
return Big(toNumber(value)).toFixed(toNumber(wx.getStorageSync('PRICE_HOLD_POINT') || 2));
};
/** 数量保留位数 */
export const numRetentionDigits = (value?: number) => {
return toNumber(
Big(toNumber(value)).toFixed(toNumber(wx.getStorageSync('NUMS_HOLD_POINT') || 2)),
);
};
/** 数量保留位数字符串类型 */
export const numRetentionDigitsString = (value?: number) => {
return Big(toNumber(value)).toFixed(toNumber(wx.getStorageSync('NUMS_HOLD_POINT') || 2));
};
/**
* sleep
* @param callback 回调函数
* @param ms 毫秒, 默认300ms
* @returns
*/
export const sleep = (callback?: () => void, ms = 300): Promise<boolean> => {
return new Promise((resolve) => {
setTimeout(() => {
callback?.();
resolve(true);
}, ms);
});
};
export const cloneLite = (data: any) => JSON.parse(JSON.stringify(data));