代码合并

This commit is contained in:
2026-03-28 18:19:42 +08:00
3 changed files with 644 additions and 454 deletions

View File

@@ -226,9 +226,27 @@ export const useCartsStore = defineStore("carts", () => {
const isLinkFinshed = ref(false);
// 当前购物车数据(现在 getAllGoodsList 能直接访问)
const list = useStorage<any[]>("carts", []);
// 历史订单数据(现在 getAllGoodsList 能直接访问),不从本地缓存获取,改为从接口获取
const oldOrder = ref<any>({
const list = useStorage<any[]>(
"carts",
[],
localStorage,
{
serializer: {
read: (rawValue) => {
// 没有值时直接返回默认空数组
if (!rawValue) return []
try {
return JSON.parse(rawValue)
} catch {
return []
}
},
write: (value) => JSON.stringify(value),
},
}
)
// 历史订单数据(现在 getAllGoodsList 能直接访问)
const oldOrder = useStorage<any>("Instead_olold_order", {
detailMap: [],
originAmount: 0
});