bug修复

This commit is contained in:
Waiting 2024-06-03 22:59:17 +08:00
parent 4d7f73aedf
commit c56ea0dd73
6 changed files with 39 additions and 19 deletions

View File

@ -51,11 +51,11 @@ export default {
else {
//
if(import.meta.env.VITE_APP_BASE_API.includes('api.lakeapp')) {
setCompanyId('1150930317231112193');
setRegisterStoreId('1150930317436633090');
// setCompanyId('1150930317231112193');
// setRegisterStoreId('1150930317436633090');
// setCompanyId('1471673498334113794');
// setRegisterStoreId('1471673498413805570');
setCompanyId('1471673498334113794');
setRegisterStoreId('1471673498413805570');
}
//
else {
@ -109,7 +109,7 @@ export default {
}
//
if(options?.query.couponsId) {
if(options?.path?.includes('ticketsBuy/ticketsBuy') && options?.query.couponsId) {
setTimeout(() => {
uni.reLaunch({
url: 'pages/common/groupbuy/index?id=' + options?.query.couponsId

View File

@ -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, getOpenId, goPath, isLogin } from '@/utils';
import { getOpenId, goPath, isLogin } from '@/utils';
import { storeToRefs } from 'pinia';
import { UserBean } from '@/store/modules/user/types';
@ -196,7 +196,7 @@ const fetchCompanyList = (fn: any = undefined) => {
} else {
let index = companyList.value.findIndex((res: { id: string }) => res.id === getApp().globalData?.companyId);
//
if(index < 0) {
if(index < 0 && !getApp()?.globalData?.storeId) {
goPath('/pages/common/register/index');
return;
}

View File

@ -49,7 +49,8 @@
</text>
<view class='bottom-sku-view c-flex-row'>
<text>
{{ item.checkedStock.colorName||'均色' }}{{ item.checkedStock.sizeName||'均码' }} x{{ item.checkedStock.count }}
{{ item.checkedStock.colorName || '均色' }}{{ item.checkedStock.sizeName || '均码' }}
x{{ item.checkedStock.count }}
</text>
<text>¥{{ item.price }}</text>
</view>
@ -160,16 +161,16 @@ const buildSqbParams = computed(() => {
client_sn: orderBean.value?.id || '',
return_url: '/pages/common/payresult/index',
total_amount: Number(((totalPrice.value || 0) * 100).toFixed(2)),
terminal_sn: terminalInfo.value.terminalSn,
terminal_sn: terminalInfo.value?.terminalSn,
subject: orderBean?.value?.orderGoods[0].name || '未知',
subject_img: orderBean?.value?.orderGoods[0].images || '',
merchant_name: terminalInfo.value.companyName,
merchant_name: terminalInfo.value?.companyName,
notify_url: 'https://www.baidu.com'
}, true);
return {
...params,
sign: hexMD5(parseParameter(params) + '&key=' + terminalInfo.value.terminalKey).toUpperCase()
sign: hexMD5(parseParameter(params) + '&key=' + terminalInfo.value?.terminalKey).toUpperCase()
};
});
@ -202,7 +203,10 @@ const navigateTo = (e: any) => {
};
const createOrder = async () => {
if(!terminalInfo.value) {
showToast('当前店铺未配置收款渠道,请联系商家');
return;
}
//
if(tabIndex.value == 1 && !deliveryAddress.value.addrid) {
showToast('请选择收货地址');

View File

@ -12,11 +12,11 @@ const useShoppingCartStore = defineStore('shoppingCart', {
key: 'shoppingCartState',
storage: {
setItem(key, value) {
uni.setStorageSync(key, value || []); // [!code warning]
uni.setStorageSync(key, value); // [!code warning]
uni.setStorageSync(`shoppingCart_${getCompanyId()}`, JSON.parse(value).shoppingCartList);
},
getItem(key) {
return uni.getStorageSync(uni.getStorageSync(`shoppingCart_${getCompanyId()}`)) || []; // [!code warning]
return uni.getStorageSync(uni.getStorageSync(`shoppingCart_${getCompanyId()}`)) || '';
}
},
// 部分持久化状态的点符号路径数组,[]意味着没有状态被持久化(默认为undefined持久化整个状态)
@ -33,12 +33,19 @@ const useShoppingCartStore = defineStore('shoppingCart', {
},
getSameGoodsIndex: (state) => (goodsId: string, colorId: string, sizeId: string) => {
if(Array.isArray(state.shoppingCartList)) {
return state.shoppingCartList?.findIndex(res => res.id === goodsId && res.checkedStock.colorId === colorId && res.checkedStock.sizeId === sizeId);
} else {
return -1;
}
}
},
actions: {
save(partial: Partial<GoodsBean>) {
if(!Array.isArray(this.shoppingCartList)) {
this.shoppingCartList = [];
}
this.shoppingCartList.push(partial as GoodsBean);
},

View File

@ -93,10 +93,17 @@ 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)
}
// }
resolve(res);
} else {
@ -152,7 +159,7 @@ const useUserStore = defineStore('user', {
} else {
await clearToken();
}
await this.fetchTerminal();
this.fetchTerminal();
this.fetchCompanyInfo();
},

View File

@ -41,8 +41,10 @@ function getCompanyId() {
function setCompanyId(companyId: string) {
uni.setStorageSync(CompanyIdKey, companyId);
if(getApp()?.globalData) {
getApp().globalData!.companyId = companyId;
}
}
function getReferrerUserId() {
return uni.getStorageSync(ReferrerUserIdKey);