This commit is contained in:
@@ -93,3 +93,7 @@ export const getHdOrJfGoods = (data: object) =>
|
|||||||
|
|
||||||
// 获取支付列表
|
// 获取支付列表
|
||||||
export const getPayList = (data: object) => request('/payType', data, 'POST');
|
export const getPayList = (data: object) => request('/payType', data, 'POST');
|
||||||
|
|
||||||
|
// 获取商家详情
|
||||||
|
export const getMerDetail = (data: object) =>
|
||||||
|
request('/store/details', data, 'POST');
|
||||||
|
|||||||
@@ -185,9 +185,8 @@ const toPage = async (url: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const toMerDetails = item => {
|
const toMerDetails = item => {
|
||||||
Taro.setStorageSync('mer_info', item);
|
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: `/pages/mer/mer_detail/index`,
|
url: `/pages/mer/mer_detail/index?bid=${item.bid}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ import Taro from '@tarojs/taro';
|
|||||||
import {Left, Home, Plus, Minus} from '@nutui/icons-vue-taro';
|
import {Left, Home, Plus, Minus} from '@nutui/icons-vue-taro';
|
||||||
import {Ref, ref} from 'vue';
|
import {Ref, ref} from 'vue';
|
||||||
import {calculateDistance} from '@/utils';
|
import {calculateDistance} from '@/utils';
|
||||||
import {getGoodList, getMerCategory} from '@/api/goods';
|
import {getGoodList, getMerCategory, getMerDetail} from '@/api/goods';
|
||||||
import Cart from '@/components/Cart.vue';
|
import Cart from '@/components/Cart.vue';
|
||||||
|
|
||||||
const statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight;
|
const statusBarHeight = Taro.getSystemInfoSync()?.statusBarHeight;
|
||||||
@@ -150,7 +150,19 @@ const userLocalNum = ref({
|
|||||||
t: 0,
|
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({
|
Taro.getLocation({
|
||||||
type: 'wgs84',
|
type: 'wgs84',
|
||||||
success: res => {
|
success: res => {
|
||||||
@@ -158,14 +170,22 @@ Taro.useDidShow(async () => {
|
|||||||
userLocalNum.value.t = res.latitude;
|
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({
|
Taro.setNavigationBarTitle({
|
||||||
title: mer_info.value.name,
|
title: mer_info.value.name,
|
||||||
});
|
});
|
||||||
swiperList.value = mer_info.value.img.split(',');
|
swiperList.value = mer_info.value.img.split(',');
|
||||||
await get_class_list();
|
console.log(res);
|
||||||
await cartRef.value.get_cart_list();
|
};
|
||||||
});
|
|
||||||
|
|
||||||
const clickPhone = () => {
|
const clickPhone = () => {
|
||||||
Taro.makePhoneCall({
|
Taro.makePhoneCall({
|
||||||
@@ -194,7 +214,7 @@ const get_class_list = async () => {
|
|||||||
Bid: mer_info.value.bid,
|
Bid: mer_info.value.bid,
|
||||||
});
|
});
|
||||||
class_list.value = res.data.data || [];
|
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) => {
|
// const clickTab = (val: any) => {
|
||||||
|
|||||||
@@ -1,32 +1,35 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import Taro from "@tarojs/taro";
|
import Taro from '@tarojs/taro';
|
||||||
import { ref } from "vue";
|
import {ref} from 'vue';
|
||||||
import { getVerifyCode, phoneLogin } from "@/api/user";
|
import {getVerifyCode, phoneLogin, getPersonalInfo} from '@/api/user';
|
||||||
import logoImg from "../../../static/logo.jpg";
|
import logoImg from '../../../static/logo.jpg';
|
||||||
|
|
||||||
Taro.useLoad((options) => {
|
const optData = ref<any>({});
|
||||||
|
|
||||||
|
Taro.useLoad(options => {
|
||||||
|
optData.value = options;
|
||||||
console.log(options);
|
console.log(options);
|
||||||
});
|
});
|
||||||
|
|
||||||
const basicData = ref({
|
const basicData = ref({
|
||||||
phone: "",
|
phone: '',
|
||||||
code: "",
|
code: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
const smsDisabled = ref(false);
|
const smsDisabled = ref(false);
|
||||||
|
|
||||||
const smsStr = ref("获取验证码");
|
const smsStr = ref('获取验证码');
|
||||||
|
|
||||||
// 获取验证码
|
// 获取验证码
|
||||||
const getSmsCode = async () => {
|
const getSmsCode = async () => {
|
||||||
if (
|
if (
|
||||||
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
|
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
|
||||||
basicData.value.phone
|
basicData.value.phone,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return Taro.showToast({
|
return Taro.showToast({
|
||||||
title: "请输入正确的手机号码",
|
title: '请输入正确的手机号码',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
});
|
||||||
await getVerifyCode({
|
await getVerifyCode({
|
||||||
phone: basicData.value.phone.toString(),
|
phone: basicData.value.phone.toString(),
|
||||||
@@ -39,7 +42,7 @@ const getSmsCode = async () => {
|
|||||||
if (time === 0) {
|
if (time === 0) {
|
||||||
clearInterval(timer);
|
clearInterval(timer);
|
||||||
smsDisabled.value = false;
|
smsDisabled.value = false;
|
||||||
smsStr.value = "获取验证码";
|
smsStr.value = '获取验证码';
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
@@ -47,36 +50,58 @@ const getSmsCode = async () => {
|
|||||||
const login = async () => {
|
const login = async () => {
|
||||||
if (
|
if (
|
||||||
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
|
!/^1(3\d|4[5-9]|5[0-35-9]|6[567]|7[0-8]|8\d|9[0-35-9])\d{8}$/.test(
|
||||||
basicData.value.phone
|
basicData.value.phone,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return Taro.showToast({
|
return Taro.showToast({
|
||||||
title: "请输入正确的手机号码",
|
title: '请输入正确的手机号码',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
});
|
||||||
if (!basicData.value.code)
|
if (!basicData.value.code)
|
||||||
return Taro.showToast({
|
return Taro.showToast({
|
||||||
title: "请输入验证码",
|
title: '请输入验证码',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
});
|
});
|
||||||
|
|
||||||
const res = await phoneLogin({
|
const res = await phoneLogin({
|
||||||
Phone: basicData.value.phone,
|
Phone: basicData.value.phone,
|
||||||
Code: basicData.value.code,
|
Code: basicData.value.code,
|
||||||
Referee: Taro.getStorageSync("bind_id") || "",
|
Referee: Taro.getStorageSync('bind_id') || '',
|
||||||
});
|
});
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: res.msg,
|
title: res.msg,
|
||||||
icon: "success",
|
icon: 'success',
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
});
|
});
|
||||||
Taro.setStorageSync("token", res.data.token);
|
Taro.setStorageSync('token', res.data.token);
|
||||||
setTimeout(() => {
|
if (optData.value.isBack !== 'undefined') {
|
||||||
Taro.removeStorageSync("bind_id");
|
await getUserInfo();
|
||||||
Taro.switchTab({
|
Taro.navigateBack({
|
||||||
url: "/pages/user/index",
|
delta: 2,
|
||||||
});
|
});
|
||||||
}, 2000);
|
} else {
|
||||||
|
setTimeout(() => {
|
||||||
|
Taro.removeStorageSync('wx_code');
|
||||||
|
Taro.removeStorageSync('bind_id');
|
||||||
|
Taro.switchTab({
|
||||||
|
url: '/pages/user/index',
|
||||||
|
});
|
||||||
|
}, 2000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const getUserInfo = async () => {
|
||||||
|
const res = await getPersonalInfo();
|
||||||
|
const userInfo = {
|
||||||
|
...res.data,
|
||||||
|
data: {
|
||||||
|
...res.data.data,
|
||||||
|
permission: res.data.data.permission
|
||||||
|
? JSON.parse(res.data.data.permission)
|
||||||
|
: {},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
Taro.setStorageSync('userInfo', userInfo);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -94,8 +119,7 @@ const login = async () => {
|
|||||||
v-model="basicData.phone"
|
v-model="basicData.phone"
|
||||||
class="nut-input-text"
|
class="nut-input-text"
|
||||||
placeholder="请输入手机号码"
|
placeholder="请输入手机号码"
|
||||||
type="text"
|
type="text" />
|
||||||
/>
|
|
||||||
</nut-form-item>
|
</nut-form-item>
|
||||||
<nut-form-item label="验证码:">
|
<nut-form-item label="验证码:">
|
||||||
<view style="display: flex">
|
<view style="display: flex">
|
||||||
@@ -103,8 +127,7 @@ const login = async () => {
|
|||||||
v-model="basicData.code"
|
v-model="basicData.code"
|
||||||
class="nut-input-text"
|
class="nut-input-text"
|
||||||
placeholder="请输入验证码"
|
placeholder="请输入验证码"
|
||||||
type="text"
|
type="text" />
|
||||||
/>
|
|
||||||
<nut-button
|
<nut-button
|
||||||
size="mini"
|
size="mini"
|
||||||
style="margin-left: 10px"
|
style="margin-left: 10px"
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const userInfo = ref({
|
|||||||
phone: '',
|
phone: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
const optData = ref({});
|
const optData = ref<any>({});
|
||||||
|
|
||||||
Taro.useLoad(opt => {
|
Taro.useLoad(opt => {
|
||||||
optData.value = opt;
|
optData.value = opt;
|
||||||
@@ -76,7 +76,7 @@ const getPhoneNumber = async (e: any) => {
|
|||||||
duration: 2000,
|
duration: 2000,
|
||||||
});
|
});
|
||||||
Taro.setStorageSync('token', ress.data.token);
|
Taro.setStorageSync('token', ress.data.token);
|
||||||
if (optData.value.isBack) {
|
if (optData.value.isBack !== 'undefined') {
|
||||||
await getUserInfo();
|
await getUserInfo();
|
||||||
Taro.navigateBack({
|
Taro.navigateBack({
|
||||||
delta: 1,
|
delta: 1,
|
||||||
@@ -119,7 +119,7 @@ const toPage = () => {
|
|||||||
icon: 'none',
|
icon: 'none',
|
||||||
});
|
});
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: '/pages/users/bindPhone/index?type=1',
|
url: `/pages/users/bindPhone/index?type=1&isBack=${optData.value.isBack}`,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user