审核模式

This commit is contained in:
Dev
2026-10-15 15:16:17 +08:00
parent 1c9927efd5
commit 3bc5ea70fe
11 changed files with 75 additions and 8 deletions
+25
View File
@@ -82,6 +82,31 @@ export async function fetchPlatformCommissionRatio() {
return DEFAULT_COMMISSION_RATIO;
}
const CASE_VIEW_STORAGE_KEY = 'goodsCaseView';
let caseViewCache = null;
/**
* 商品是否按案例展示(不显示价格和购买入口)
* 成功后缓存;失败时用上次成功的本地记录
* @returns {Promise<boolean>}
*/
export async function fetchGoodsCaseView() {
if (caseViewCache !== null) {
return caseViewCache;
}
try {
const res = await fetchConfig();
if (res.code === 1) {
caseViewCache = res.data?.goods_case_view === true || res.data?.goods_case_view === 1;
wx.setStorageSync(CASE_VIEW_STORAGE_KEY, caseViewCache);
return caseViewCache;
}
} catch (err) {
console.error('fetchGoodsCaseView failed:', err);
}
return wx.getStorageSync(CASE_VIEW_STORAGE_KEY) === true;
}
/**
* 计算扣除平台服务费后的预计到手金额(保留两位小数)
* @param {number|string} amount 报价/总费用(元)