feat(custom):
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-07-27 11:05:25 +08:00
parent e55cc6c9e0
commit 9ea8f419f4
5 changed files with 87 additions and 41 deletions

View File

@@ -133,7 +133,7 @@ import Taro from '@tarojs/taro';
import {Left, Home, Plus, Minus} from '@nutui/icons-vue-taro';
import {Ref, ref} from 'vue';
import {calculateDistance} from '@/utils';
import {getGoodList, getMerCategory} from '@/api/goods';
import {getGoodList, getMerCategory, getMerDetail} from '@/api/goods';
import Cart from '@/components/Cart.vue';
const statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight;
@@ -150,7 +150,19 @@ const userLocalNum = ref({
t: 0,
});
Taro.useDidShow(async () => {
const bid = ref('');
Taro.useLoad(opt => {
bid.value = opt.bid;
});
Taro.useDidShow(opt => {
if (!Taro.getStorageSync('token')) {
Taro.navigateTo({
url: '/pages/users/login/index?isBack=1',
});
return;
}
Taro.getLocation({
type: 'wgs84',
success: res => {
@@ -158,14 +170,22 @@ Taro.useDidShow(async () => {
userLocalNum.value.t = res.latitude;
},
});
mer_info.value = Taro.getStorageSync('mer_info');
get_class_list();
cartRef.value.get_cart_list();
getStoreInfo();
});
const getStoreInfo = async () => {
const res = await getMerDetail({
Bid: bid.value,
});
mer_info.value = res.data.data;
Taro.setNavigationBarTitle({
title: mer_info.value.name,
});
swiperList.value = mer_info.value.img.split(',');
await get_class_list();
await cartRef.value.get_cart_list();
});
console.log(res);
};
const clickPhone = () => {
Taro.makePhoneCall({
@@ -194,7 +214,7 @@ const get_class_list = async () => {
Bid: mer_info.value.bid,
});
class_list.value = res.data.data || [];
await get_good_list(class_list.value[0].ID as number);
await get_good_list(class_list.value[0]?.ID as number);
};
// const clickTab = (val: any) => {