购物车逻辑完善

个人信息存储优化
团购下单
This commit is contained in:
2024-03-31 03:19:19 +08:00
parent 074b0057da
commit 1fc0aa432b
17 changed files with 316 additions and 166 deletions

View File

@@ -66,7 +66,7 @@
import { getCompanyInfo, getCompanyList } from '@/api/company';
import { useUserStore } from '@/store';
import { assetsUrl } from '@/utils/assets';
import { goPath, setCompanyId } from '@/utils';
import { getCompanyId, goPath, isLogin, setCompanyId } from '@/utils';
import { storeToRefs } from 'pinia';
const store = useUserStore();
@@ -93,22 +93,30 @@ const submenuList = [
}
];
onLoad(async (e) => {
const data = await getCompanyInfo(userInfo.value.companyId);
bannerList.value = data.bannerinx?.map((res: { src: string }) => res.src);
recommendBannerList.value = data.bannerhot?.map((res: { src: string }) => res.src);
onLoad((e) => {
console.log('home load e ', e);
});
getCompanyList(userInfo.value.maOpenId).then(res => {
const companyList = res.map((res: { company: any }) => res.company);
const userList = res.map((res: { user: any }) => res.user);
uni.showActionSheet({
itemList: companyList.map((res: { companyName: string }) => res.companyName),
success: (res) => {
setCompanyId(companyList[res.tapIndex].id);
store.setUserInfo(userList[res.tapIndex]);
onShow(async () => {
if(isLogin()) {
const data = await getCompanyInfo(userInfo.value.companyId);
bannerList.value = data.bannerinx?.map((res: { src: string }) => res.src);
recommendBannerList.value = data.bannerhot?.map((res: { src: string }) => res.src);
getCompanyList(userInfo.value.maOpenId).then(res => {
const companyList = res.map((res: { company: any }) => res.company);
const userList = res.map((res: { user: any }) => res.user);
if(getCompanyId() == undefined) {
uni.showActionSheet({
itemList: companyList.map((res: { companyName: string }) => res.companyName),
success: (res) => {
setCompanyId(companyList[res.tapIndex].id);
store.setUserInfo(userList[res.tapIndex]);
}
});
}
});
});
}
});
const swiperChange = (e: any) => {