Compare commits

...

6 Commits

Author SHA1 Message Date
224db6202c 删除日志 2024-06-06 11:48:19 +08:00
dbd3800314 原先团购处理 2024-06-05 22:20:18 +08:00
4545fbfab5 异常处理 2024-06-05 17:54:18 +08:00
49af2cd078 接口错误码兼容处理 2024-06-05 15:47:15 +08:00
bca9390042 bug修复 2024-06-04 10:23:37 +08:00
bad6348393 bug修复 2024-06-03 23:00:40 +08:00
11 changed files with 69 additions and 34 deletions

View File

@ -112,7 +112,7 @@ export default {
if(options?.path?.includes('ticketsBuy/ticketsBuy') && options?.query.couponsId) {
setTimeout(() => {
uni.reLaunch({
url: 'pages/common/groupbuy/index?id=' + options?.query.couponsId
url: 'pages/common/groupbuy/detail?id=' + options?.query.couponsId
});
}, 500);
}

View File

@ -18,7 +18,7 @@
"modules": {}
},
"mp-weixin": {
"appid": "wx92e663dc11d0c0a8",
"appid": "wx67a750d0ceed4d88",
"setting": {
"urlCheck": false
},

View File

@ -38,6 +38,12 @@
"style": {
"navigationBarTitleText": "肃客会员"
}
},
{
"path": "pages/coupons/ticketsBuy/ticketsBuy",
"style": {
"navigationBarTitleText": "团购详情"
}
}
],
"subPackages": [

View File

@ -26,29 +26,22 @@
<script setup lang='ts'>
import { useUserStore } from '@/store';
import { assetsUrl } from '@/utils/assets';
import { getRegisterStoreId, showToast } from '@/utils';
import { showToast } from '@/utils';
const userStore = useUserStore();
const isAgreePrivacy = ref(false);
async function wechatLogin() {
function wechatLogin() {
if(!isAgreePrivacy.value) {
showToast('请先阅读并同意小程序隐私保护协议');
return;
}
uni.showLoading();
userStore.login().then(() => {
uni.hideLoading();
uni.reLaunch({ url: '/pages/home/index' });
});
// await uni.showLoading();
// const result = await userStore.login();
// uni.hideLoading();
// if(result) {
// await uni.reLaunch({ url: '/pages/home/index' });
// } else {
// await uni.navigateTo({ url: '/pages/common/register/index' });
// }
}
const bindCheck = () => {

View File

@ -120,7 +120,7 @@ const save = async () => {
avatarUrl: avatarUrl.value,
nickName: nickName.value,
telephone: telephone.value,
birthday: dayjs(birthday.value).format('YYYY-MM-DD HH:mm:ss'),
birthday: dayjs(birthday.value).isValid() ? dayjs(birthday.value).format('YYYY-MM-DD HH:mm:ss') : dayjs().format('YYYY-MM-DD HH:mm:ss'),
gender: gender.value
};

View File

@ -0,0 +1,29 @@
<template>
</template>
<script lang='ts' setup>
onLoad((options) => {
getApp().logger?.info('ticketsBuy options: ', options);
let couponId = options?.couponsId;
if(options?.query && couponId == undefined) {
const params = decodeURIComponent(options?.query);
couponId = getQueryParam(params, 'couponsId');
}
setTimeout(() => {
uni.reLaunch({
url: `/pages/common/groupbuy/detail?id=${couponId}`
});
}, 300);
});
function getQueryParam(queryParams: string, key: string) {
let regex = new RegExp('(?:[?&]|^)' + key + '=([^&]+)'),
match = queryParams.match(regex);
return match && match[1];
}
</script>
<style lang='scss' scoped>
</style>

View File

@ -86,7 +86,7 @@ const submenuList = [
title: '注册有礼',
icon: assetsUrl('ic_register_gift2.png'),
path: '/pages/common/register/reward'
// path: '/pages/common/register/index'
// path: '/pages/coupons/ticketsBuy/ticketsBuy?couponsId=1797773484774432769'
},
{
title: '团购秒杀',
@ -196,10 +196,14 @@ const fetchCompanyList = (fn: any = undefined) => {
} else {
let index = companyList.value.findIndex((res: { id: string }) => res.id === getApp().globalData?.companyId);
//
if(index < 0 && !getApp()?.globalData?.storeId) {
goPath('/pages/common/register/index');
return;
if(index < 0) {
if(!getApp()?.globalData?.storeId) {
goPath('/pages/common/register/index');
return;
}
index = 0;
}
userStore.setUserInfo(userList.value[index]);
userStore.setCompanyInfo(companyList.value[index]);
avatarModifyRemind();

View File

@ -80,7 +80,7 @@ const params = ref<{
nickName: userInfo.value.nickName,
telephone: userInfo.value.telephone,
gender: userInfo.value.gender,
birthday: userInfo.value.birthday
birthday: userInfo.value.birthday|| dayjs().format('YYYY-MM-DD')
});
onLoad(() => {
@ -135,7 +135,7 @@ const save = async () => {
const result = await updateProfile({
...params.value,
birthday: dayjs(params.value.birthday).format('YYYY-MM-DD HH:mm:ss'),
birthday: dayjs(birthday.value).isValid() ? dayjs(birthday.value).format('YYYY-MM-DD HH:mm:ss') : dayjs().format('YYYY-MM-DD HH:mm:ss'),
birthdayType: 0
});

View File

@ -93,16 +93,13 @@ const useUserStore = defineStore('user', {
// referrerUserId: getReferrerUserId()
});
getApp().globalData?.logger.info('login result: ', res);
console.log('login result: ', res);
console.log('login result: ', res.token);
console.log('login result: ', res.sessionKey);
setToken(res.token);
setSessionKey(res.sessionKey);
setOpenId(res.maOpenId);
if(res.user){
await this.setUserInfo(res.user);
}else {
this.setUserInfo(res.userInfo)
if(res.user) {
this.setUserInfo(res.user);
} else {
this.setUserInfo(res.userInfo);
}
// }
resolve(res);
@ -155,7 +152,9 @@ const useUserStore = defineStore('user', {
if(this.userInfo) {
this.userInfo.userDiscount = this.getUserDiscount;
await setCompanyId(this.userInfo.companyId);
getApp().globalData!.companyId = this.userInfo.companyId;
if(getApp().globalData){
getApp().globalData.companyId = this.userInfo.companyId;
}
} else {
await clearToken();
}
@ -165,7 +164,9 @@ const useUserStore = defineStore('user', {
setCompanyInfo(partial: Partial<any>) {
this.companyInfo = partial as any;
getApp().globalData!.companyId = this.companyInfo.id;
if(getApp()?.globalData) {
getApp().globalData.companyId = this.companyInfo.id;
}
},
setDeliveryAddress(partial: Partial<any>) {

View File

@ -40,9 +40,11 @@ function getCompanyId() {
}
function setCompanyId(companyId: string) {
uni.setStorageSync(CompanyIdKey, companyId);
if(getApp()?.globalData) {
getApp().globalData!.companyId = companyId;
if(companyId) {
uni.setStorageSync(CompanyIdKey, companyId);
if(getApp()?.globalData) {
getApp().globalData.companyId = companyId;
}
}
}

View File

@ -1,5 +1,5 @@
import type { HttpError, HttpRequestConfig, HttpResponse } from 'uview-plus/libs/luch-request';
import { getToken } from '@/utils/auth';
import { getCompanyId, getToken } from '@/utils/auth';
import { showMessage } from '@/utils/request/status';
import { useUserStore } from '@/store';
@ -22,7 +22,7 @@ function requestInterceptors() {
const token = getToken();
if(token && config.header) {
config.header.token = token;
config.header.companyid = getApp().globalData?.companyId;
config.header.companyid = getCompanyId();
// config.header.contentType = "x-www-form-urlencoded"
}
@ -61,7 +61,7 @@ function responseInterceptors() {
}
// 登录状态失效,重新登录
if(data.code === 4011) {
if(data.code === 4011 || data?.retcode === 4011) {
// 是否在获取token中,防止重复获取
if(!isRefreshing) {
// 修改登录状态为true