bug修复
This commit is contained in:
parent
4d7f73aedf
commit
c56ea0dd73
10
src/App.vue
10
src/App.vue
@ -51,11 +51,11 @@ export default {
|
|||||||
else {
|
else {
|
||||||
//生产环境
|
//生产环境
|
||||||
if(import.meta.env.VITE_APP_BASE_API.includes('api.lakeapp')) {
|
if(import.meta.env.VITE_APP_BASE_API.includes('api.lakeapp')) {
|
||||||
setCompanyId('1150930317231112193');
|
// setCompanyId('1150930317231112193');
|
||||||
setRegisterStoreId('1150930317436633090');
|
// setRegisterStoreId('1150930317436633090');
|
||||||
|
|
||||||
// setCompanyId('1471673498334113794');
|
setCompanyId('1471673498334113794');
|
||||||
// setRegisterStoreId('1471673498413805570');
|
setRegisterStoreId('1471673498413805570');
|
||||||
}
|
}
|
||||||
//测试
|
//测试
|
||||||
else {
|
else {
|
||||||
@ -109,7 +109,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//原先商品团购
|
//原先商品团购
|
||||||
if(options?.query.couponsId) {
|
if(options?.path?.includes('ticketsBuy/ticketsBuy') && options?.query.couponsId) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.reLaunch({
|
uni.reLaunch({
|
||||||
url: 'pages/common/groupbuy/index?id=' + options?.query.couponsId
|
url: 'pages/common/groupbuy/index?id=' + options?.query.couponsId
|
||||||
|
@ -72,7 +72,7 @@ import CompanyDialog from '@/components/company-dialog.vue';
|
|||||||
import { getCompanyList } from '@/api/company';
|
import { getCompanyList } from '@/api/company';
|
||||||
import { useUserStore } from '@/store';
|
import { useUserStore } from '@/store';
|
||||||
import { assetsUrl, defaultAvatar, defaultImage } from '@/utils/assets';
|
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 { storeToRefs } from 'pinia';
|
||||||
import { UserBean } from '@/store/modules/user/types';
|
import { UserBean } from '@/store/modules/user/types';
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ const fetchCompanyList = (fn: any = undefined) => {
|
|||||||
} else {
|
} else {
|
||||||
let index = companyList.value.findIndex((res: { id: string }) => res.id === getApp().globalData?.companyId);
|
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');
|
goPath('/pages/common/register/index');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,8 @@
|
|||||||
</text>
|
</text>
|
||||||
<view class='bottom-sku-view c-flex-row'>
|
<view class='bottom-sku-view c-flex-row'>
|
||||||
<text>
|
<text>
|
||||||
{{ item.checkedStock.colorName||'均色' }},{{ item.checkedStock.sizeName||'均码' }} x{{ item.checkedStock.count }}
|
{{ item.checkedStock.colorName || '均色' }},{{ item.checkedStock.sizeName || '均码' }}
|
||||||
|
x{{ item.checkedStock.count }}
|
||||||
</text>
|
</text>
|
||||||
<text>¥{{ item.price }}</text>
|
<text>¥{{ item.price }}</text>
|
||||||
</view>
|
</view>
|
||||||
@ -160,16 +161,16 @@ const buildSqbParams = computed(() => {
|
|||||||
client_sn: orderBean.value?.id || '',
|
client_sn: orderBean.value?.id || '',
|
||||||
return_url: '/pages/common/payresult/index',
|
return_url: '/pages/common/payresult/index',
|
||||||
total_amount: Number(((totalPrice.value || 0) * 100).toFixed(2)),
|
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: orderBean?.value?.orderGoods[0].name || '未知',
|
||||||
subject_img: orderBean?.value?.orderGoods[0].images || '',
|
subject_img: orderBean?.value?.orderGoods[0].images || '',
|
||||||
merchant_name: terminalInfo.value.companyName,
|
merchant_name: terminalInfo.value?.companyName,
|
||||||
notify_url: 'https://www.baidu.com'
|
notify_url: 'https://www.baidu.com'
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...params,
|
...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 () => {
|
const createOrder = async () => {
|
||||||
|
if(!terminalInfo.value) {
|
||||||
|
showToast('当前店铺未配置收款渠道,请联系商家');
|
||||||
|
return;
|
||||||
|
}
|
||||||
//邮寄
|
//邮寄
|
||||||
if(tabIndex.value == 1 && !deliveryAddress.value.addrid) {
|
if(tabIndex.value == 1 && !deliveryAddress.value.addrid) {
|
||||||
showToast('请选择收货地址');
|
showToast('请选择收货地址');
|
||||||
|
@ -12,11 +12,11 @@ const useShoppingCartStore = defineStore('shoppingCart', {
|
|||||||
key: 'shoppingCartState',
|
key: 'shoppingCartState',
|
||||||
storage: {
|
storage: {
|
||||||
setItem(key, value) {
|
setItem(key, value) {
|
||||||
uni.setStorageSync(key, value || []); // [!code warning]
|
uni.setStorageSync(key, value); // [!code warning]
|
||||||
uni.setStorageSync(`shoppingCart_${getCompanyId()}`, JSON.parse(value).shoppingCartList);
|
uni.setStorageSync(`shoppingCart_${getCompanyId()}`, JSON.parse(value).shoppingCartList);
|
||||||
},
|
},
|
||||||
getItem(key) {
|
getItem(key) {
|
||||||
return uni.getStorageSync(uni.getStorageSync(`shoppingCart_${getCompanyId()}`)) || []; // [!code warning]
|
return uni.getStorageSync(uni.getStorageSync(`shoppingCart_${getCompanyId()}`)) || '';
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 部分持久化状态的点符号路径数组,[]意味着没有状态被持久化(默认为undefined,持久化整个状态)
|
// 部分持久化状态的点符号路径数组,[]意味着没有状态被持久化(默认为undefined,持久化整个状态)
|
||||||
@ -33,12 +33,19 @@ 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);
|
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: {
|
actions: {
|
||||||
save(partial: Partial<GoodsBean>) {
|
save(partial: Partial<GoodsBean>) {
|
||||||
|
if(!Array.isArray(this.shoppingCartList)) {
|
||||||
|
this.shoppingCartList = [];
|
||||||
|
}
|
||||||
this.shoppingCartList.push(partial as GoodsBean);
|
this.shoppingCartList.push(partial as GoodsBean);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -93,10 +93,17 @@ const useUserStore = defineStore('user', {
|
|||||||
// referrerUserId: getReferrerUserId()
|
// referrerUserId: getReferrerUserId()
|
||||||
});
|
});
|
||||||
getApp().globalData?.logger.info('login result: ', res);
|
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);
|
setToken(res.token);
|
||||||
setSessionKey(res.sessionKey);
|
setSessionKey(res.sessionKey);
|
||||||
setOpenId(res.maOpenId);
|
setOpenId(res.maOpenId);
|
||||||
await this.setUserInfo(res.user);
|
if(res.user){
|
||||||
|
await this.setUserInfo(res.user);
|
||||||
|
}else {
|
||||||
|
this.setUserInfo(res.userInfo)
|
||||||
|
}
|
||||||
// }
|
// }
|
||||||
resolve(res);
|
resolve(res);
|
||||||
} else {
|
} else {
|
||||||
@ -152,7 +159,7 @@ const useUserStore = defineStore('user', {
|
|||||||
} else {
|
} else {
|
||||||
await clearToken();
|
await clearToken();
|
||||||
}
|
}
|
||||||
await this.fetchTerminal();
|
this.fetchTerminal();
|
||||||
this.fetchCompanyInfo();
|
this.fetchCompanyInfo();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -41,7 +41,9 @@ function getCompanyId() {
|
|||||||
|
|
||||||
function setCompanyId(companyId: string) {
|
function setCompanyId(companyId: string) {
|
||||||
uni.setStorageSync(CompanyIdKey, companyId);
|
uni.setStorageSync(CompanyIdKey, companyId);
|
||||||
getApp().globalData!.companyId = companyId;
|
if(getApp()?.globalData) {
|
||||||
|
getApp().globalData!.companyId = companyId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getReferrerUserId() {
|
function getReferrerUserId() {
|
||||||
|
Loading…
Reference in New Issue
Block a user