add
This commit is contained in:
parent
c899d8f472
commit
ec33cc6119
|
@ -760,7 +760,7 @@
|
||||||
}
|
}
|
||||||
if (type == 2) {
|
if (type == 2) {
|
||||||
if (!formData2.mobile) return uni.$u.toast('请填写电话号码');
|
if (!formData2.mobile) return uni.$u.toast('请填写电话号码');
|
||||||
if (formData2.price < formData2.label_limit) return uni.$u.toast(
|
if (Number(formData2.price) < Number(formData2.label_limit)) return uni.$u.toast(
|
||||||
`${formData2.label_name}角色最低金额不能低于${formData2.label_limit}元`);
|
`${formData2.label_name}角色最低金额不能低于${formData2.label_limit}元`);
|
||||||
formData2.store_id = STORE_INFO.id
|
formData2.store_id = STORE_INFO.id
|
||||||
// formData2.recharge_type = 'INDUSTRYMEMBERS'
|
// formData2.recharge_type = 'INDUSTRYMEMBERS'
|
||||||
|
@ -800,9 +800,13 @@
|
||||||
if (!formData.code) return uni.$u.toast('请输入短信验证码');
|
if (!formData.code) return uni.$u.toast('请输入短信验证码');
|
||||||
if (!formData.address) return uni.$u.toast('请选择地址');
|
if (!formData.address) return uni.$u.toast('请选择地址');
|
||||||
if (!formData.label_id) return uni.$u.toast('请选择用户身份');
|
if (!formData.label_id) return uni.$u.toast('请选择用户身份');
|
||||||
if (formData.price < formData.label_limit) return uni.$u.toast(
|
if (Number(formData.price) < Number(formData.label_limit)) {
|
||||||
|
return uni.$u.toast(
|
||||||
`${formData.label_name}角色最低金额不能低于${formData.label_limit}元`);
|
`${formData.label_name}角色最低金额不能低于${formData.label_limit}元`);
|
||||||
formData.store_id = STORE_INFO.id
|
formData.store_id = STORE_INFO.id
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (Role.value == 1) {
|
if (Role.value == 1) {
|
||||||
// formData.recharge_type = 'INDUSTRYMEMBERS'
|
// formData.recharge_type = 'INDUSTRYMEMBERS'
|
||||||
// formData.user_ship = formData.label_id
|
// formData.user_ship = formData.label_id
|
||||||
|
|
|
@ -34,8 +34,8 @@
|
||||||
<up-transition :show="!showWeixin">
|
<up-transition :show="!showWeixin">
|
||||||
<view class="form">
|
<view class="form">
|
||||||
<view class="input">
|
<view class="input">
|
||||||
<up-input :customStyle="{ height: '100%' }" v-model="loginForm.phone" placeholderClass="place"
|
<up-input :customStyle="{ height: '100%' }" v-model="loginForm.phone"
|
||||||
border="none" placeholder="请输入手机号" type="number">
|
placeholderClass="place" border="none" placeholder="请输入手机号" type="number">
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
|
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
|
||||||
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/48491202404281006484208.png">
|
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/48491202404281006484208.png">
|
||||||
|
@ -81,28 +81,28 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import {
|
import {
|
||||||
onBackPress
|
onBackPress
|
||||||
} from "@dcloudio/uni-app"
|
} from "@dcloudio/uni-app"
|
||||||
import {
|
import {
|
||||||
ref
|
ref
|
||||||
} from "vue"
|
} from "vue"
|
||||||
import {
|
import {
|
||||||
userLoginApi,
|
userLoginApi,
|
||||||
userLoginWeixinApi,
|
userLoginWeixinApi,
|
||||||
getMobileByMnpApi,
|
getMobileByMnpApi,
|
||||||
getStoreInfo
|
getStoreInfo
|
||||||
} from "@/api/user.js";
|
} from "@/api/user.js";
|
||||||
import useUserStore from "@/store/user.js"
|
import useUserStore from "@/store/user.js"
|
||||||
import bindPhone from "@/components/bindPhone.vue"
|
import bindPhone from "@/components/bindPhone.vue"
|
||||||
import modal from "@/components/modal.vue"
|
import modal from "@/components/modal.vue"
|
||||||
import {
|
import {
|
||||||
config
|
config
|
||||||
} from "@/config/app.js"
|
} from "@/config/app.js"
|
||||||
|
|
||||||
|
|
||||||
const showOfficial = ref(false);
|
const showOfficial = ref(false);
|
||||||
const navToIndex = () => {
|
const navToIndex = () => {
|
||||||
if (userStore.userInfo && userStore.token) uni.reLaunch({
|
if (userStore.userInfo && userStore.token) uni.reLaunch({
|
||||||
url: '/pages/index/index'
|
url: '/pages/index/index'
|
||||||
})
|
})
|
||||||
|
@ -116,10 +116,10 @@ const navToIndex = () => {
|
||||||
// url: '/pageQuota/quotation/index'
|
// url: '/pageQuota/quotation/index'
|
||||||
// })
|
// })
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 微信公众号绑定
|
// 微信公众号绑定
|
||||||
const officialCode = () => {
|
const officialCode = () => {
|
||||||
console.log("jinfas")
|
console.log("jinfas")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -131,20 +131,20 @@ const officialCode = () => {
|
||||||
userStore.setUserInfo(user);
|
userStore.setUserInfo(user);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const userStore = useUserStore(); //使用pinia进行状态管理
|
const userStore = useUserStore(); //使用pinia进行状态管理
|
||||||
if (userStore.userInfo && userStore.userInfo.mobile) {
|
if (userStore.userInfo && userStore.userInfo.mobile) {
|
||||||
navToIndex();
|
navToIndex();
|
||||||
} else {
|
} else {
|
||||||
userStore.setToken('');
|
userStore.setToken('');
|
||||||
userStore.setUserInfo({});
|
userStore.setUserInfo({});
|
||||||
}
|
}
|
||||||
|
|
||||||
const showWeixin = ref(true); //是否显示微信登录
|
const showWeixin = ref(true); //是否显示微信登录
|
||||||
const isAgree = ref(false); //是否同意协议
|
const isAgree = ref(false); //是否同意协议
|
||||||
|
|
||||||
const weixinLogin = () => {
|
const weixinLogin = () => {
|
||||||
if (!isAgree.value) {
|
if (!isAgree.value) {
|
||||||
uni.$u.sleep(1000).then(res => {
|
uni.$u.sleep(1000).then(res => {
|
||||||
isAgree.value = true;
|
isAgree.value = true;
|
||||||
|
@ -201,10 +201,10 @@ const weixinLogin = () => {
|
||||||
uni.$u.toast('登录失败');
|
uni.$u.toast('登录失败');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const showBind = ref(false); //是否显示绑定手机号弹窗
|
const showBind = ref(false); //是否显示绑定手机号弹窗
|
||||||
const getPhoneNumber = (e) => {
|
const getPhoneNumber = (e) => {
|
||||||
if (e.detail?.errMsg == 'getPhoneNumber:ok') {
|
if (e.detail?.errMsg == 'getPhoneNumber:ok') {
|
||||||
getMobileByMnpApi({
|
getMobileByMnpApi({
|
||||||
code: e.detail.code
|
code: e.detail.code
|
||||||
|
@ -239,17 +239,17 @@ const getPhoneNumber = (e) => {
|
||||||
console.log("用户拒绝授权");
|
console.log("用户拒绝授权");
|
||||||
return uni.$u.toast('您拒绝了授权');
|
return uni.$u.toast('您拒绝了授权');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const loginForm = ref({
|
const loginForm = ref({
|
||||||
phone: '15366662222',
|
phone: '15366662222',
|
||||||
code: ''
|
code: ''
|
||||||
})
|
})
|
||||||
const isPhone = () => { //检验手机号是否正确
|
const isPhone = () => { //检验手机号是否正确
|
||||||
loginForm.value.phone = loginForm.value.phone.replace(/\s*/g, ""); //去除空格
|
loginForm.value.phone = loginForm.value.phone.replace(/\s*/g, ""); //去除空格
|
||||||
return !/^1[3456789]\d{9}$/.test(loginForm.value.phone);
|
return !/^1[3456789]\d{9}$/.test(loginForm.value.phone);
|
||||||
}
|
}
|
||||||
const codeLogin = () => {
|
const codeLogin = () => {
|
||||||
if (!isAgree.value) return uni.$u.toast('请先阅读并同意协议');
|
if (!isAgree.value) return uni.$u.toast('请先阅读并同意协议');
|
||||||
// 验证码登录
|
// 验证码登录
|
||||||
if (isPhone()) return uni.$u.toast('请输入正确的手机号码');
|
if (isPhone()) return uni.$u.toast('请输入正确的手机号码');
|
||||||
|
@ -262,17 +262,17 @@ const codeLogin = () => {
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(res);
|
console.log(res);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const tips = ref('');
|
const tips = ref('');
|
||||||
const seconds = ref(60);
|
const seconds = ref(60);
|
||||||
const uCodeRef = ref(null);
|
const uCodeRef = ref(null);
|
||||||
|
|
||||||
const codeChange = (text) => {
|
const codeChange = (text) => {
|
||||||
tips.value = text;
|
tips.value = text;
|
||||||
};
|
};
|
||||||
|
|
||||||
const getCode = () => {
|
const getCode = () => {
|
||||||
if (!isAgree.value) return uni.$u.toast('请先阅读并同意协议');
|
if (!isAgree.value) return uni.$u.toast('请先阅读并同意协议');
|
||||||
if (uCodeRef.value.canGetCode) {
|
if (uCodeRef.value.canGetCode) {
|
||||||
if (isPhone()) return uni.$u.toast('请输入正确的手机号码');
|
if (isPhone()) return uni.$u.toast('请输入正确的手机号码');
|
||||||
|
@ -290,28 +290,28 @@ const getCode = () => {
|
||||||
} else {
|
} else {
|
||||||
uni.$u.toast('倒计时结束后再发送');
|
uni.$u.toast('倒计时结束后再发送');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 微信小程序无法拦截原生返回按钮,所以使用自定义导航拦截返回
|
// 微信小程序无法拦截原生返回按钮,所以使用自定义导航拦截返回
|
||||||
const navBack = () => {
|
const navBack = () => {
|
||||||
if (showWeixin.value == false) {
|
if (showWeixin.value == false) {
|
||||||
showWeixin.value = true;
|
showWeixin.value = true;
|
||||||
return true;
|
return true;
|
||||||
} else uni.navigateBack();
|
} else uni.navigateBack();
|
||||||
}
|
}
|
||||||
const navgo = (url) => {
|
const navgo = (url) => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url
|
url
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
page {
|
page {
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-box {
|
.login-box {
|
||||||
width: 700rpx;
|
width: 700rpx;
|
||||||
height: 80vh;
|
height: 80vh;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
@ -394,5 +394,5 @@ page {
|
||||||
color: #20B128;
|
color: #20B128;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
Loading…
Reference in New Issue