feat: 核销接口参数调整
This commit is contained in:
@@ -92,11 +92,38 @@
|
|||||||
uni.setStorageSync(STORAGE_KEY, next);
|
uni.setStorageSync(STORAGE_KEY, next);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const toStoreIdsString = (raw) => {
|
||||||
|
if (raw === null || raw === undefined) return '';
|
||||||
|
if (Array.isArray(raw)) {
|
||||||
|
return raw.map((v) => String(v).trim()).filter(Boolean).join(',');
|
||||||
|
}
|
||||||
|
const s = String(raw).trim();
|
||||||
|
if (!s) return '';
|
||||||
|
if (s.includes(',')) return s.replace(/\s+/g, '');
|
||||||
|
const n = Number(s);
|
||||||
|
if (Number.isFinite(n) && n > 0) return String(n);
|
||||||
|
return s.replace(/\s+/g, '');
|
||||||
|
};
|
||||||
|
|
||||||
const getVerifyIds = async () => {
|
const getVerifyIds = async () => {
|
||||||
const localIds = Array.isArray(userStore?.userInfo?.ids) ? userStore.userInfo.ids : [];
|
const local = userStore?.userInfo || {};
|
||||||
if (localIds.length) return localIds;
|
const fromLocal =
|
||||||
const userInfo = await userStore.getInfo();
|
local.storeIds ??
|
||||||
return Array.isArray(userInfo?.ids) ? userInfo.ids : [];
|
local.storeIdList ??
|
||||||
|
local.pickUpStoreIds ??
|
||||||
|
local.pickUpStoreIdList ??
|
||||||
|
local.storeId;
|
||||||
|
let storeIds = toStoreIdsString(fromLocal);
|
||||||
|
if (storeIds) return storeIds;
|
||||||
|
const fetched = await userStore.getInfo();
|
||||||
|
const fromFetched =
|
||||||
|
fetched?.storeIds ??
|
||||||
|
fetched?.storeIdList ??
|
||||||
|
fetched?.pickUpStoreIds ??
|
||||||
|
fetched?.pickUpStoreIdList ??
|
||||||
|
fetched?.storeId;
|
||||||
|
storeIds = toStoreIdsString(fromFetched);
|
||||||
|
return storeIds;
|
||||||
};
|
};
|
||||||
|
|
||||||
const verifyCode = async (code) => {
|
const verifyCode = async (code) => {
|
||||||
@@ -107,8 +134,8 @@
|
|||||||
}
|
}
|
||||||
if (verifying.value) return false;
|
if (verifying.value) return false;
|
||||||
const ids = await getVerifyIds();
|
const ids = await getVerifyIds();
|
||||||
if (!ids.length) {
|
if (!ids) {
|
||||||
uni.showToast({ title: '缺少核销ids', icon: 'none' });
|
uni.showToast({ title: '缺少门店ID', icon: 'none' });
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
verifying.value = true;
|
verifying.value = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user