diff --git a/src/api/goods.ts b/src/api/goods.ts
index 9d5c5ad..301744e 100644
--- a/src/api/goods.ts
+++ b/src/api/goods.ts
@@ -93,3 +93,7 @@ export const getHdOrJfGoods = (data: object) =>
// 获取支付列表
export const getPayList = (data: object) => request('/payType', data, 'POST');
+
+// 获取商家详情
+export const getMerDetail = (data: object) =>
+ request('/store/details', data, 'POST');
diff --git a/src/components/MerList.vue b/src/components/MerList.vue
index 84a67a9..2b5f77a 100644
--- a/src/components/MerList.vue
+++ b/src/components/MerList.vue
@@ -185,9 +185,8 @@ const toPage = async (url: string) => {
};
const toMerDetails = item => {
- Taro.setStorageSync('mer_info', item);
Taro.navigateTo({
- url: `/pages/mer/mer_detail/index`,
+ url: `/pages/mer/mer_detail/index?bid=${item.bid}`,
});
};
diff --git a/src/pages/mer/mer_detail/index.vue b/src/pages/mer/mer_detail/index.vue
index 1246c49..e6adc0a 100644
--- a/src/pages/mer/mer_detail/index.vue
+++ b/src/pages/mer/mer_detail/index.vue
@@ -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) => {
diff --git a/src/pages/users/bindPhone/index.vue b/src/pages/users/bindPhone/index.vue
index 46c809e..0f3c4bc 100644
--- a/src/pages/users/bindPhone/index.vue
+++ b/src/pages/users/bindPhone/index.vue
@@ -1,32 +1,35 @@
@@ -94,8 +119,7 @@ const login = async () => {
v-model="basicData.phone"
class="nut-input-text"
placeholder="请输入手机号码"
- type="text"
- />
+ type="text" />
@@ -103,8 +127,7 @@ const login = async () => {
v-model="basicData.code"
class="nut-input-text"
placeholder="请输入验证码"
- type="text"
- />
+ type="text" />
({});
Taro.useLoad(opt => {
optData.value = opt;
@@ -76,7 +76,7 @@ const getPhoneNumber = async (e: any) => {
duration: 2000,
});
Taro.setStorageSync('token', ress.data.token);
- if (optData.value.isBack) {
+ if (optData.value.isBack !== 'undefined') {
await getUserInfo();
Taro.navigateBack({
delta: 1,
@@ -119,7 +119,7 @@ const toPage = () => {
icon: 'none',
});
Taro.navigateTo({
- url: '/pages/users/bindPhone/index?type=1',
+ url: `/pages/users/bindPhone/index?type=1&isBack=${optData.value.isBack}`,
});
};