bug修复
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<view class='swiper-container'>
|
||||
<swiper class='swiper' :interval='1500' :duration='1000' @change='swiperChange'>
|
||||
<swiper-item v-for='(item,index) in bannerList' :key='index'>
|
||||
<image :src='item||defaultImage' mode='aspectFill'/>
|
||||
<image :src='item||defaultImage' mode='aspectFill' />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class='indicator'>
|
||||
@@ -189,13 +189,19 @@ onUnload(() => {
|
||||
}
|
||||
});
|
||||
|
||||
onShareAppMessage((e) => {
|
||||
return {
|
||||
title: groupBuyBean.value?.goods?.name || 'VIP顾客中心',
|
||||
path: `/pages/common/groupbuy/detail?id=${groupBuyBean.value?.id}&companyId=${getApp().globalData?.companyId}&storeId=${getApp().globalData?.storeId}`
|
||||
};
|
||||
});
|
||||
|
||||
const isNotStated = () => {
|
||||
return dayjs(groupBuyBean.value?.startDate).isAfter(Date.now());
|
||||
};
|
||||
|
||||
const isPending = () => {
|
||||
return dayjs(groupBuyBean.value?.startDate).isBefore(Date.now()) && dayjs(groupBuyBean.value?.endDate).isAfter(Date.now());
|
||||
;
|
||||
};
|
||||
|
||||
const isEnded = () => {
|
||||
|
@@ -37,11 +37,6 @@ async function wechatLogin() {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!getRegisterStoreId()) {
|
||||
showToast('请从公众号消息窗口点击店名打开小程序');
|
||||
return;
|
||||
}
|
||||
|
||||
userStore.login().then(() => {
|
||||
uni.hideLoading();
|
||||
uni.reLaunch({ url: '/pages/home/index' });
|
||||
|
@@ -48,13 +48,13 @@ import { ref } from 'vue';
|
||||
import { getTelephone } from '@/api/user';
|
||||
import { useUserStore } from '@/store';
|
||||
import { assetsUrl } from '@/utils/assets';
|
||||
import { getSessionKey, showToast } from '@/utils';
|
||||
import { getRegisterStoreId, getSessionKey, showToast } from '@/utils';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const userStore = useUserStore();
|
||||
const { userInfo } = storeToRefs(userStore);
|
||||
|
||||
const birthday = ref(userInfo.value.birthday);
|
||||
const birthday = ref(userInfo.value.birthday || dayjs().format('YYYY-MM-DD'));
|
||||
const nickName = ref(userInfo.value.nickName);
|
||||
const gender = ref(userInfo.value.gender);
|
||||
const telephone = ref(userInfo.value.telephone);
|
||||
@@ -109,13 +109,18 @@ const changeGender = (index: number) => {
|
||||
};
|
||||
|
||||
const save = async () => {
|
||||
if(!getRegisterStoreId()) {
|
||||
showToast('请从公众号消息窗口点击店名打开小程序');
|
||||
return;
|
||||
}
|
||||
|
||||
await uni.showLoading();
|
||||
const registerForm = {
|
||||
image: avatarUrl.value,
|
||||
avatarUrl: avatarUrl.value,
|
||||
nickName: nickName.value,
|
||||
telephone: telephone.value,
|
||||
birthday: dayjs(birthday.value).format("YYYY-MM-DD HH:mm:ss"),
|
||||
birthday: dayjs(birthday.value).format('YYYY-MM-DD HH:mm:ss'),
|
||||
gender: gender.value
|
||||
};
|
||||
|
||||
|
@@ -72,7 +72,7 @@ import CompanyDialog from '@/components/company-dialog.vue';
|
||||
import { getCompanyList } from '@/api/company';
|
||||
import { useUserStore } from '@/store';
|
||||
import { assetsUrl, defaultAvatar, defaultImage } from '@/utils/assets';
|
||||
import { getCompanyId, goPath, isLogin } from '@/utils';
|
||||
import { getCompanyId, getOpenId, goPath, isLogin } from '@/utils';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { UserBean } from '@/store/modules/user/types';
|
||||
|
||||
@@ -128,35 +128,73 @@ onLoad((e) => {
|
||||
onShow(async () => {
|
||||
if(isLogin()) {
|
||||
// userStore.getProfile();
|
||||
if(userInfo.value.maOpenId) {
|
||||
fetchCompanyList();
|
||||
} else {
|
||||
await userStore.getProfile();
|
||||
}
|
||||
fetchCompanyList();
|
||||
} else {
|
||||
// setToken('42ae187265fb4688804fd294cbcf99f1')
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您还未登录,请先登录',
|
||||
showCancel: true,
|
||||
success: (res) => {
|
||||
if(res.confirm) {
|
||||
goPath('/pages/common/login/index');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const switchCompany = () => {
|
||||
fetchCompanyList((companyList: any[], userList: any[]) => {
|
||||
companyDialogRef.value.show(getCompanyId(), (index: number) => {
|
||||
companyDialogRef.value.show(getApp().globalData?.companyId, (index: number) => {
|
||||
userStore.setUserInfo(userList[index]);
|
||||
userStore.setCompanyInfo(companyList[index]);
|
||||
|
||||
avatarModifyRemind();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function avatarModifyRemind() {
|
||||
setTimeout(() => {
|
||||
if(userInfo.value.image === defaultAvatar) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '为了提供更优质的个性化服务,请先修改头像',
|
||||
showCancel: true,
|
||||
success: (res) => {
|
||||
if(res.confirm) {
|
||||
goPath('/pages/mine/subs/profile/index');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 300);
|
||||
}
|
||||
|
||||
const fetchCompanyList = (fn: any = undefined) => {
|
||||
const maOpenId = userInfo.value?.maOpenId || (userList.value.filter((res: UserBean) => res?.maOpenId !== '')[0]?.maOpenId);
|
||||
const maOpenId = getOpenId() || userInfo.value?.maOpenId || (userList.value.filter((res: UserBean) => res?.maOpenId !== '')[0]?.maOpenId);
|
||||
getCompanyList(maOpenId).then(res => {
|
||||
companyList.value = res.map((res: { company: any }) => res.company);
|
||||
userList.value = res.map((res: { user: any }) => res.user);
|
||||
|
||||
if(companyList.value.length === 0) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '当前店铺还未注册,请先注册',
|
||||
showCancel: true,
|
||||
success: (res) => {
|
||||
if(res.confirm) {
|
||||
goPath('/pages/common/register/index');
|
||||
}
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(fn != undefined && fn instanceof Function) {
|
||||
fn(companyList.value, userList.value);
|
||||
} else {
|
||||
let index = companyList.value.findIndex((res: { id: string }) => res.id === getCompanyId());
|
||||
|
||||
let index = companyList.value.findIndex((res: { id: string }) => res.id === getApp().globalData?.companyId);
|
||||
//未在当前公司下注册
|
||||
if(index < 0) {
|
||||
goPath('/pages/common/register/index');
|
||||
@@ -164,6 +202,7 @@ const fetchCompanyList = (fn: any = undefined) => {
|
||||
}
|
||||
userStore.setUserInfo(userList.value[index]);
|
||||
userStore.setCompanyInfo(companyList.value[index]);
|
||||
avatarModifyRemind();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@@ -38,7 +38,7 @@ const coupons = ref<CouponBean[]>([]);
|
||||
|
||||
const fetchData = async (status: number) => {
|
||||
const { list } = await getCouponList({
|
||||
companyId: getCompanyId(),
|
||||
companyId: getApp()?.globalData?.companyId,
|
||||
memberId: userInfo.value?.id,
|
||||
status: status,
|
||||
pageNum: 1,
|
||||
|
@@ -147,6 +147,13 @@ onLoad(async (e: any) => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
|
||||
onShareAppMessage((e) => {
|
||||
return {
|
||||
title: goodsBean.value?.name || 'VIP顾客中心',
|
||||
path: `/pages/common/groupbuy/detail?id=${goodsBean.value?.id}&companyId=${getApp().globalData?.companyId}&storeId=${getApp().globalData?.storeId}`
|
||||
};
|
||||
});
|
||||
|
||||
const getStockColorCount = computed(() => {
|
||||
const list = Array.from(new Set(goodsBean.value?.stocks?.map(item => item.colorName)))
|
||||
.map(colorName => goodsBean.value?.stocks?.find(item => item.colorName === colorName)!);
|
||||
|
@@ -48,7 +48,7 @@
|
||||
<view class='c-flex-row'>
|
||||
<text>生日</text>
|
||||
<picker mode='date' :disabled='(userInfo.birthday?.length||0)!=0' @change='changeDate'>
|
||||
<text>{{ dayjs(params?.birthday).format('YYYY-MM-DD') || '请选择生日' }}</text>
|
||||
<text>{{ dayjs(params?.birthday || Date.now()).format('YYYY-MM-DD') || '请选择生日' }}</text>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
|
Reference in New Issue
Block a user