审核模式
This commit is contained in:
@@ -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 报价/总费用(元)
|
||||
|
||||
Reference in New Issue
Block a user