bug修复

This commit is contained in:
2024-06-17 16:02:46 +08:00
parent 14b723ce1f
commit 13ee0f593c
4 changed files with 44 additions and 12 deletions

View File

@@ -142,7 +142,7 @@
<script lang='ts' setup>
import { assetsUrl, defaultImage } from '@/utils/assets';
import dayjs from 'dayjs';
import { formatTimeWithZeroPad, getCompanyId, getOpenId, goLogin, goPath, isLogin } from '@/utils';
import { formatTimeWithZeroPad, getCompanyId, getOpenId, goLogin, goPath, isLogin, showToast } from '@/utils';
import SkuDialog from '@/components/sku-dialog.vue';
import CouponItem from './components/coupon-item.vue';
@@ -180,6 +180,8 @@ const countdownTime = ref<{
const recordList = ref<RecordBean[]>([]);
const currentPageNum = ref(1);
const shareGoodsId = ref();
const shareCouponId = ref();
onLoad(async (e: any) => {
if(isLogin()) {
@@ -188,10 +190,12 @@ onLoad(async (e: any) => {
groupBuyBean.value = await getGroupBuyDetail(e.id);
}
if(e.shareId != undefined) {
shareGoodsId.value = e.shareId;
const { group, share } = await getShareGoodsDetail(e.shareId);
groupBuyBean.value = group;
}
if(e.couponId != undefined) {
shareCouponId.value = e.couponId;
isCouponGoodsDetail.value = true;
groupBuyBean.value = await getShareGoodsCouponDetail(e.couponId);
groupBuyBean.value.price = groupBuyBean.value?.offsetPrice;
@@ -201,6 +205,7 @@ onLoad(async (e: any) => {
const maOpenId = getOpenId() || userInfo.value?.maOpenId;
const data = await getCompanyList(maOpenId);
const companyList = data.map((item: any) => item.company);
const userList = data.map((item: any) => item.user);
let index = companyList.findIndex((res: {
id: string
}) => res.id === (getApp()?.globalData?.shareCompanyId || getCompanyId()));
@@ -217,7 +222,8 @@ onLoad(async (e: any) => {
}
}
});
return;
} else {
await userStore.setUserInfo(userList[index]);
}
// setCompanyId('1512403904150138881');
@@ -230,6 +236,19 @@ onLoad(async (e: any) => {
await fetchRecommendList();
await fetchBuyRecordList();
}
} else {
showToast('查询失败', {
complete: () => {
const pages = getCurrentPages();
if(pages.map(item => item?.route?.includes('pages/home/index'))) {
uni.navigateBack();
} else {
uni.reLaunch({
url: '/pages/home/index'
});
}
}
});
}
uni.hideLoading();
} else {
@@ -244,9 +263,15 @@ onUnload(() => {
});
onShareAppMessage((e) => {
let path = `/pages/common/groupbuy/detail?id=${groupBuyBean.value?.id}&companyId=${getApp().globalData?.companyId}&storeId=${getApp().globalData?.storeId}`;
if(shareGoodsId.value) {
path = `/pages/common/groupbuy/detail?shareId=${shareGoodsId.value}&companyId=${getApp().globalData?.companyId}&storeId=${getApp().globalData?.storeId}`;
} else if(shareCouponId.value) {
path = `/pages/common/groupbuy/detail?couponId=${shareCouponId.value}&companyId=${getApp().globalData?.companyId}&storeId=${getApp().globalData?.storeId}`;
}
return {
title: groupBuyBean.value?.goods?.name || 'VIP顾客中心',
path: `/pages/common/groupbuy/detail?id=${groupBuyBean.value?.id}&companyId=${getApp().globalData?.companyId}&storeId=${getApp().globalData?.storeId}`
path: path
};
});

View File

@@ -97,6 +97,13 @@ const navigateTo = (e: any) => {
uni.hideLoading();
}
});
},
onFailure: (e: any) => {
showToast(e, {
complete: () => {
uni.navigateBack();
}
});
}
});
};

View File

@@ -144,17 +144,11 @@ const navigateTo = (e: any) => {
icon: 'none',
duration: 1500,
complete(result) {
if(e?.includes('订单号重复')) {
createOrder();
}
}
});
// showToast(e, {
// icon: 'none',
// complete: () => {
// setTimeout(() => {
// uni.navigateBack();
// }, 1500);
// }
// });
}
});
};

View File

@@ -208,6 +208,12 @@ const fetchCompanyList = (fn: any = undefined) => {
userStore.setUserInfo(userList.value[index]);
userStore.setCompanyInfo(companyList.value[index]);
avatarModifyRemind();
//首页选中处理后清空分享数据,避免再次选中
if(getApp()?.globalData?.shareCompanyId && getApp()?.globalData?.shareStoreId) {
getApp().globalData!.shareCompanyI = '';
getApp().globalData!.shareStoreId = '';
}
}
}
);