问题修复

This commit is contained in:
2024-04-16 00:53:34 +08:00
parent 877469ab43
commit 0562554266
9 changed files with 37 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang='ts'> <script setup lang='ts'>
import { mpUpdate, setReferrerUserId, setRegisterStoreId } from '@/utils'; import { mpUpdate, setCompanyId, setReferrerUserId, setRegisterStoreId } from '@/utils';
onLaunch((options) => { onLaunch((options) => {
console.log('App Launch options ', options); console.log('App Launch options ', options);
@@ -10,6 +10,11 @@ onLaunch((options) => {
setReferrerUserId(options.query.referrerUserId); setReferrerUserId(options.query.referrerUserId);
} }
//保存注册门店id
if(options.query.companyId) {
setCompanyId(options.query.companyId);
}
//保存注册门店id //保存注册门店id
if(options.query.storeId) { if(options.query.storeId) {
setRegisterStoreId(options.query.storeId); setRegisterStoreId(options.query.storeId);
@@ -25,6 +30,10 @@ onShow(() => {
onHide(() => { onHide(() => {
console.log('App Hide'); console.log('App Hide');
}); });
// globalData : {
// test: '';
// }
</script> </script>
<style lang='scss'> <style lang='scss'>

View File

@@ -4,7 +4,8 @@ export interface LoginParams {
// phone: string; // phone: string;
code: string; code: string;
userInfo: any; userInfo: any;
referrerUserId: string; storeId: string;
// referrerUserId: string;
} }
export interface RegisterParams { export interface RegisterParams {

View File

@@ -111,8 +111,8 @@ const show = async (goodsId: string, fn: Function) => {
} }
if(skuSizeList) { if(skuSizeList) {
//skuSizeList.value![0].existingNumber = 2; // skuSizeList.value![0].existingNumber = 2;
//skuSizeList.value![2].existingNumber = 2; // skuSizeList.value![2].existingNumber = 2;
} }
}; };

View File

@@ -57,7 +57,7 @@
<view class='bottom-banner-view'> <view class='bottom-banner-view'>
<swiper :indicator-dots='true' :autoplay='true' :interval='3000' :duration='1000'> <swiper :indicator-dots='true' :autoplay='true' :interval='3000' :duration='1000'>
<swiper-item v-for='(item, index) in companyConfigInfo.bannerhot' :key='index'> <swiper-item v-for='(item, index) in companyConfigInfo?.bannerhot' :key='index'>
<image :src='item.src' mode='aspectFill' /> <image :src='item.src' mode='aspectFill' />
</swiper-item> </swiper-item>
</swiper> </swiper>

View File

@@ -121,7 +121,7 @@ onLoad(async (e: any) => {
pageSize: 20, pageSize: 20,
bean: { bean: {
keyword: '', keyword: '',
typeIds: ['1724629185362591745'] typeIds: []
} }
} }
}); });

View File

@@ -46,7 +46,7 @@ const bindInput = async (e: any) => {
pageSize: 100, pageSize: 100,
bean: { bean: {
keyword: e.detail.value, keyword: e.detail.value,
typeIds: ['1724629185362591745'] typeIds: []
} }
} }
}); });

View File

@@ -47,7 +47,7 @@
<view class='divider' /> <view class='divider' />
<view class='c-flex-row'> <view class='c-flex-row'>
<text>生日</text> <text>生日</text>
<picker mode='date' :disabled='userInfo.birthday!=""' @change='changeDate'> <picker mode='date' :disabled='(userInfo.birthday?.length||0)!=0' @change='changeDate'>
<text>{{ params?.birthday || '请选择生日' }}</text> <text>{{ params?.birthday || '请选择生日' }}</text>
</picker> </picker>
</view> </view>

View File

@@ -4,7 +4,7 @@ import { getCompanyId } from '@/utils';
const useShoppingCartStore = defineStore('shoppingCart', { const useShoppingCartStore = defineStore('shoppingCart', {
state: (): { shoppingCartList: GoodsBean[] } => ({ state: (): { shoppingCartList: GoodsBean[] } => ({
shoppingCartList: uni.getStorageSync(`shoppingCart_${getCompanyId()}`) == '' ? [] : uni.getStorageSync(`shoppingCart_${getCompanyId()}`) as GoodsBean[] shoppingCartList: uni.getStorageSync(`shoppingCart_${getCompanyId()}`) === '' ? [] : uni.getStorageSync(`shoppingCart_${getCompanyId()}`) as GoodsBean[]
}), }),
persist: { persist: {
@@ -33,7 +33,7 @@ const useShoppingCartStore = defineStore('shoppingCart', {
}, },
getSameGoodsIndex: (state) => (goodsId: string, colorId: string, sizeId: string) => { getSameGoodsIndex: (state) => (goodsId: string, colorId: string, sizeId: string) => {
return state.shoppingCartList.findIndex(res => res.id === goodsId && res.checkedStock.colorId === colorId && res.checkedStock.sizeId === sizeId) || -1; return state.shoppingCartList?.findIndex(res => res.id === goodsId && res.checkedStock.colorId === colorId && res.checkedStock.sizeId === sizeId) || -1;
} }
}, },

View File

@@ -1,7 +1,7 @@
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import type { providerType, UserBean } from './types'; import type { providerType, UserBean } from './types';
import { getTerminal, getUserProfile, login, logout as userLogout, register } from '@/api/user/index'; import { getTerminal, getUserProfile, login, logout as userLogout, register } from '@/api/user/index';
import { clearToken, getReferrerUserId, getRegisterStoreId, setCompanyId, setToken } from '@/utils/auth'; import { clearToken, getRegisterStoreId, setCompanyId, setToken } from '@/utils/auth';
import type { LoginResult, RegisterParams, TerminalBean } from '@/api/user/types'; import type { LoginResult, RegisterParams, TerminalBean } from '@/api/user/types';
import { getCompanyInfo } from '@/api/company'; import { getCompanyInfo } from '@/api/company';
@@ -112,27 +112,30 @@ const useUserStore = defineStore('user', {
const res = await login({ const res = await login({
code: result.code, code: result.code,
userInfo: userInfo, userInfo: userInfo,
storeId: getRegisterStoreId()
// referrerUserId: '1727303781559697409' // referrerUserId: '1727303781559697409'
referrerUserId: getReferrerUserId() // referrerUserId: getReferrerUserId()
}); });
if(res.user == undefined || res.user.id === null) { if(res.user == undefined || res.user.id === null) {
const registerForm = { const registerForm = {
unionId: res.user.unionId, unionId: res.user?.unionId,
openId: res.user.openId, openId: res.user?.openId,
maOpenId: res.user.maOpenId, maOpenId: res.user?.maOpenId,
image: res.user.image, image: res.user?.image,
nickName: res.user.nickName, nickName: res.user?.nickName,
telephone: res.user.telephone, telephone: res.user?.telephone,
birthday: res.user.birthday, birthday: res.user?.birthday,
companyId: res.user.companyId, companyId: res.user?.companyId,
creatorId: res.user.creatorId, creatorId: res.user?.creatorId,
gender: res.user.gender, gender: res.user?.gender,
storeId: getRegisterStoreId() storeId: getRegisterStoreId()
}; };
setToken(res.token);
const registerResult = await this.userRegister(registerForm); const registerResult = await this.userRegister(registerForm);
if(registerResult != null) {
setToken(res.token);
await this.setUserInfo(registerResult as LoginResult); await this.setUserInfo(registerResult as LoginResult);
}
} else { } else {
setToken(res.token); setToken(res.token);
await this.setUserInfo(res.user); await this.setUserInfo(res.user);