add
This commit is contained in:
parent
08fbd02dca
commit
656d2b8cdb
|
@ -0,0 +1,9 @@
|
|||
import request from '@/utils/request';
|
||||
|
||||
export const goodListApi = (data) => {
|
||||
return request.get('/goods/goods/lists', data);
|
||||
}
|
||||
|
||||
export const goodClassListApi = (data) => {
|
||||
return request.get('/goods/goodsclass/lists', data);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
import request from '@/utils/request';
|
||||
|
||||
//报价单列表
|
||||
export const OpurchaseGoodsOfferApi = (data) => {
|
||||
return request.get('/operation/OpurchaseGoodsOffer/list', data);
|
||||
}
|
|
@ -1,49 +1,44 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<up-sticky bgColor="#fff">
|
||||
<view class="head">
|
||||
<up-search placeholder="请输入提货点名称" @search="searchKeyword" v-model="keyword"
|
||||
@custom="searchKeyword"></up-search>
|
||||
<view class="">
|
||||
<view class="" style="display: flex;justify-content: space-around;margin-top: 24rpx;color:#777777">
|
||||
<view :class="{act: tabIndex==1}" @click="tabIndex=1">
|
||||
订单列表
|
||||
</view>
|
||||
<view :class="{act: tabIndex==2}" @click="tabIndex=2">
|
||||
报价记录
|
||||
</view>
|
||||
</view>
|
||||
<view style="height: 8rpx;" />
|
||||
<view class="line" :style="{left:tabIndex==1?tabsLeft+'px':tabsRight+'px'}" />
|
||||
</view>
|
||||
</view>
|
||||
</up-sticky>
|
||||
<view class="card" v-for="item in 10">
|
||||
<view class="card-head">
|
||||
<view class="head">
|
||||
<text>PF171504442988969633</text>
|
||||
<text style="color:#20B128 ;">待报价</text>
|
||||
<text style="color:#FC452F ;">已成交</text>
|
||||
<text style="color:#777777 ;">未成交</text>
|
||||
<text style="color: #989898;">2023-04-25</text>
|
||||
</view>
|
||||
<view style="padding-right: 20rpx;">
|
||||
<view class="card-content">
|
||||
<image v-for="(item,index) in 10" style="width: 152rpx;height: 152rpx;margin-right: 20rpx;"
|
||||
src="../../static/logo.png" mode="">
|
||||
</image>
|
||||
<view class="card-content">
|
||||
<view class="card-content-l" style="width: 152rpx;height: 152rpx;">
|
||||
<image style="width: 152rpx;height: 152rpx;" src="../../static/logo.png" mode=""></image>
|
||||
<view class="status">
|
||||
未报价
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-content-r">
|
||||
<view class="title ellipsis">
|
||||
正宗新疆哈密瓜网纹瓜
|
||||
</view>
|
||||
<view class="need">
|
||||
需求量: 100斤
|
||||
</view>
|
||||
<view class="ipt">
|
||||
<up-input placeholderStyle='fontSize:24rpx' placeholder="点击数入报价数量" v-model="value1"
|
||||
style="margin-right: 10rpx;background-color:#F6F6F6;border: none;"></up-input>
|
||||
<up-input placeholderStyle='fontSize:24rpx' style="background-color: #F6F6F6;border: none;"
|
||||
placeholder="点击数入产品报价" v-model="value2"></up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="status-png">
|
||||
<image :src="errPng" style="width: 108rpx; height: 84rpx;"></image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="total">
|
||||
<view style="display: flex;align-items: center;color: #777777;"
|
||||
@click="navgo('/pageQuota/quotation/detail')">
|
||||
共4件 <up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-foot" v-if='false'>
|
||||
温馨提示:请于2024年05月20日前发货
|
||||
<view class="card-footer">
|
||||
共100斤 合计:<text style="font-size: 28rpx;color: #FC452F;font-weight: 700;">¥500.00</text>
|
||||
</view>
|
||||
<up-line style="margin-top: 30rpx;" color="#F3F3F3"></up-line>
|
||||
</view>
|
||||
|
||||
<view class="submit-btn">
|
||||
<up-button shape='circle' color='#20B128' text="提交"></up-button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
@ -52,97 +47,103 @@
|
|||
ref,
|
||||
reactive
|
||||
} from "vue"
|
||||
const value1 = ref('')
|
||||
const value2 = ref('')
|
||||
|
||||
const navgo = (url) => {
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 搜索
|
||||
const keyword = ref('')
|
||||
const searchKeyword = () => {
|
||||
console.log("sousuo1")
|
||||
}
|
||||
// 搜索结束
|
||||
|
||||
// tabsindex
|
||||
const tabIndex = ref(1)
|
||||
const {
|
||||
windowWidth
|
||||
} = uni.getSystemInfoSync();
|
||||
const tabsLeft = ref(((windowWidth / 2) - 26) / 2)
|
||||
const tabsRight = ref(tabsLeft.value + (windowWidth / 2))
|
||||
// tabsindex结束
|
||||
// 状态图片url
|
||||
const successPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/739c3202405071458553459.png')
|
||||
const errPng = ref('https://lihai001.oss-cn-chengdu.aliyuncs.com/attach/04c2c202405071501462462.png')
|
||||
// 状态图片url结束
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.content {
|
||||
|
||||
.head {
|
||||
padding: 20rpx;
|
||||
background-color: white;
|
||||
position: relative;
|
||||
|
||||
.act {
|
||||
color: #20B128;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 26px;
|
||||
height: 5rpx;
|
||||
background-color: #20B128;
|
||||
border-radius: 50rpx;
|
||||
position: absolute;
|
||||
transition: 300ms;
|
||||
}
|
||||
}
|
||||
padding: 20rpx;
|
||||
padding-bottom: 150rpx;
|
||||
|
||||
.card {
|
||||
width: 710rpx;
|
||||
margin: 20rpx auto;
|
||||
background-color: white;
|
||||
margin: 0 auto;
|
||||
padding: 20rpx;
|
||||
box-sizing: border-box;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
position: relative;
|
||||
background-color: white;
|
||||
|
||||
.card-head {
|
||||
padding: 20rpx;
|
||||
.head {
|
||||
font-size: 28rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12rpx;
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
padding: 20rpx;
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
padding-right: 152rpx;
|
||||
}
|
||||
|
||||
.total {
|
||||
width: 152rpx;
|
||||
height: 160rpx;
|
||||
position: absolute;
|
||||
// border: 1px dashed black;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
top: 100rpx;
|
||||
right: 20rpx;
|
||||
background-color: white;
|
||||
position: relative;
|
||||
|
||||
.card-content-l {
|
||||
margin-right: 20rpx;
|
||||
position: relative;
|
||||
|
||||
.status {
|
||||
width: 152rpx;
|
||||
height: 40rpx;
|
||||
background-color: rgba(0, 0, 0, .3);
|
||||
text-align: center;
|
||||
color: white;
|
||||
font-size: 24rpx;
|
||||
line-height: 40rpx;
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.card-content-r {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
|
||||
.title {
|
||||
font-size: 30rpx;
|
||||
width: 500rpx;
|
||||
}
|
||||
|
||||
.need {
|
||||
color: #777777;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.ipt {
|
||||
display: flex;
|
||||
height: 56rpx;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.status-png {
|
||||
position: absolute;
|
||||
right: 20rpx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.card-foot {
|
||||
background-color: #FFF1EC;
|
||||
color: #FC452F;
|
||||
text-indent: 2em;
|
||||
font-size: 24rpx;
|
||||
height: 74rpx;
|
||||
line-height: 74rpx;
|
||||
|
||||
.card-footer {
|
||||
margin-top: 30rpx;
|
||||
text-align: right;
|
||||
font-size: 28rpx;
|
||||
color: #060606;
|
||||
}
|
||||
}
|
||||
|
||||
.submit-btn {
|
||||
position: fixed;
|
||||
bottom: 50rpx;
|
||||
width: 710rpx;
|
||||
margin: 0 auto;
|
||||
}
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,148 @@
|
|||
<template>
|
||||
<view class="content">
|
||||
<up-sticky bgColor="#fff">
|
||||
<view class="head">
|
||||
<up-search placeholder="请输入提货点名称" @search="searchKeyword" v-model="keyword"
|
||||
@custom="searchKeyword"></up-search>
|
||||
<view class="">
|
||||
<view class="" style="display: flex;justify-content: space-around;margin-top: 24rpx;color:#777777">
|
||||
<view :class="{act: tabIndex==1}" @click="tabIndex=1">
|
||||
订单列表
|
||||
</view>
|
||||
<view :class="{act: tabIndex==2}" @click="tabIndex=2">
|
||||
报价记录
|
||||
</view>
|
||||
</view>
|
||||
<view style="height: 8rpx;" />
|
||||
<view class="line" :style="{left:tabIndex==1?tabsLeft+'px':tabsRight+'px'}" />
|
||||
</view>
|
||||
</view>
|
||||
</up-sticky>
|
||||
<view class="card" v-for="item in 10">
|
||||
<view class="card-head">
|
||||
<text>PF171504442988969633</text>
|
||||
<text style="color:#20B128 ;">待报价</text>
|
||||
<text style="color:#FC452F ;">已成交</text>
|
||||
<text style="color:#777777 ;">未成交</text>
|
||||
</view>
|
||||
<view style="padding-right: 20rpx;">
|
||||
<view class="card-content">
|
||||
<image v-for="(item,index) in 10" style="width: 152rpx;height: 152rpx;margin-right: 20rpx;"
|
||||
src="../../static/logo.png" mode="">
|
||||
</image>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="total">
|
||||
<view style="display: flex;align-items: center;color: #777777;"
|
||||
@click="navgo('/pageQuota/quotation/detail')">
|
||||
共4件 <up-icon name="arrow-right"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
<view class="card-foot" v-if='false'>
|
||||
温馨提示:请于2024年05月20日前发货
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
reactive
|
||||
} from "vue"
|
||||
|
||||
const navgo = (url) => {
|
||||
uni.navigateTo({
|
||||
url
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 搜索
|
||||
const keyword = ref('')
|
||||
const searchKeyword = () => {
|
||||
console.log("sousuo1")
|
||||
}
|
||||
// 搜索结束
|
||||
|
||||
// tabsindex
|
||||
const tabIndex = ref(1)
|
||||
const {
|
||||
windowWidth
|
||||
} = uni.getSystemInfoSync();
|
||||
const tabsLeft = ref(((windowWidth / 2) - 26) / 2)
|
||||
const tabsRight = ref(tabsLeft.value + (windowWidth / 2))
|
||||
// tabsindex结束
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.content {
|
||||
|
||||
.head {
|
||||
padding: 20rpx;
|
||||
background-color: white;
|
||||
position: relative;
|
||||
|
||||
.act {
|
||||
color: #20B128;
|
||||
}
|
||||
|
||||
.line {
|
||||
width: 26px;
|
||||
height: 5rpx;
|
||||
background-color: #20B128;
|
||||
border-radius: 50rpx;
|
||||
position: absolute;
|
||||
transition: 300ms;
|
||||
}
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 710rpx;
|
||||
margin: 20rpx auto;
|
||||
background-color: white;
|
||||
box-sizing: border-box;
|
||||
border-radius: 16rpx 16rpx 0 0;
|
||||
position: relative;
|
||||
|
||||
.card-head {
|
||||
padding: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.card-content {
|
||||
padding: 20rpx;
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
padding-right: 152rpx;
|
||||
}
|
||||
|
||||
.total {
|
||||
width: 152rpx;
|
||||
height: 160rpx;
|
||||
position: absolute;
|
||||
// border: 1px dashed black;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
top: 100rpx;
|
||||
right: 20rpx;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
.card-foot {
|
||||
background-color: #FFF1EC;
|
||||
color: #FC452F;
|
||||
text-indent: 2em;
|
||||
font-size: 24rpx;
|
||||
height: 74rpx;
|
||||
line-height: 74rpx;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -1,268 +1,281 @@
|
|||
<template>
|
||||
<view>
|
||||
<up-navbar title="登录" :autoBack="false" placeholder bgColor="rgba(0,0,0,0)">
|
||||
<template #left>
|
||||
<up-icon v-if="!showWeixin" name="arrow-left" @click="navBack" size="20"></up-icon>
|
||||
<view v-else></view>
|
||||
</template>
|
||||
</up-navbar>
|
||||
<view class="login-box">
|
||||
<image class="logo" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png"></image>
|
||||
<view class="tips">欢迎登录惠农批发</view>
|
||||
<block v-if="showWeixin">
|
||||
<up-transition :show="showWeixin">
|
||||
<view class="btn">
|
||||
<up-button @click="weixinLogin" color="#20B128" size="large"><up-icon name="weixin-fill" color="#fff"
|
||||
size="28"></up-icon>微信快捷登录</up-button>
|
||||
</view>
|
||||
<view class="btn">
|
||||
<up-button color="#ECFFEE" @click="showWeixin=false" size="large"><text
|
||||
style="color: #20B128;">使用短信验证登录</text></up-button>
|
||||
</view>
|
||||
</up-transition>
|
||||
</block>
|
||||
<block v-else>
|
||||
<up-transition :show="!showWeixin">
|
||||
<view class="form">
|
||||
<view class="input">
|
||||
<up-input :customStyle="{height: '100%'}" v-model="loginForm.phone" placeholderClass="place" border="none"
|
||||
placeholder="请输入手机号" type="number">
|
||||
<template #prefix>
|
||||
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
|
||||
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/48491202404281006484208.png"></image>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
<view class="input">
|
||||
<up-input :customStyle="{height: '100%'}" v-model="loginForm.code" :maxlength="4" placeholderClass="place"
|
||||
border="none" placeholder="请输入验证码" type="number">
|
||||
<template #prefix>
|
||||
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
|
||||
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/3a42f202404281007454918.png"></image>
|
||||
</template>
|
||||
<template #suffix>
|
||||
<up-code :seconds="seconds" ref="uCodeRef" @change="codeChange"></up-code>
|
||||
<view style="color: #20B128;" @click="getCode">{{tips}}</view>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn">
|
||||
<up-button color="#20B128" size="large" @click="codeLogin">登录</up-button>
|
||||
</view>
|
||||
</up-transition>
|
||||
</block>
|
||||
<view class="agreement">
|
||||
<image v-if="!isAgree" @click="isAgree=true" src="@/static/icon/n-check.png"></image>
|
||||
<image v-else @click="isAgree=false" src="@/static/icon/check.png"></image>
|
||||
<view>
|
||||
我已同意<text>《用户协议》</text>与<text>《隐私政策》</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<bindPhone :show="showBind" @close="showBind = false" @change="getPhoneNumber" />
|
||||
</view>
|
||||
<view>
|
||||
<up-navbar title="登录" :autoBack="false" placeholder bgColor="rgba(0,0,0,0)">
|
||||
<template #left>
|
||||
<up-icon v-if="!showWeixin" name="arrow-left" @click="navBack" size="20"></up-icon>
|
||||
<view v-else></view>
|
||||
</template>
|
||||
</up-navbar>
|
||||
<view class="login-box">
|
||||
<image class="logo" src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/35adb202404271727457954.png">
|
||||
</image>
|
||||
<view class="tips">欢迎登录惠农批发</view>
|
||||
<block v-if="showWeixin">
|
||||
<up-transition :show="showWeixin">
|
||||
<view class="btn">
|
||||
<up-button @click="weixinLogin" color="#20B128" size="large"><up-icon name="weixin-fill"
|
||||
color="#fff" size="28"></up-icon>微信快捷登录</up-button>
|
||||
</view>
|
||||
<view class="btn">
|
||||
<up-button color="#ECFFEE" @click="showWeixin=false" size="large"><text
|
||||
style="color: #20B128;">使用短信验证登录</text></up-button>
|
||||
</view>
|
||||
</up-transition>
|
||||
</block>
|
||||
<block v-else>
|
||||
<up-transition :show="!showWeixin">
|
||||
<view class="form">
|
||||
<view class="input">
|
||||
<up-input :customStyle="{height: '100%'}" v-model="loginForm.phone" placeholderClass="place"
|
||||
border="none" placeholder="请输入手机号" type="number">
|
||||
<template #prefix>
|
||||
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
|
||||
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/48491202404281006484208.png">
|
||||
</image>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
<view class="input">
|
||||
<up-input :customStyle="{height: '100%'}" v-model="loginForm.code" :maxlength="4"
|
||||
placeholderClass="place" border="none" placeholder="请输入验证码" type="number">
|
||||
<template #prefix>
|
||||
<image style="height: 40rpx;width: 40rpx;margin-top: 6rpx;"
|
||||
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/3a42f202404281007454918.png">
|
||||
</image>
|
||||
</template>
|
||||
<template #suffix>
|
||||
<up-code :seconds="seconds" ref="uCodeRef" @change="codeChange"></up-code>
|
||||
<view style="color: #20B128;" @click="getCode">{{tips}}</view>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="btn">
|
||||
<up-button color="#20B128" size="large" @click="codeLogin">登录</up-button>
|
||||
</view>
|
||||
</up-transition>
|
||||
</block>
|
||||
<view class="agreement">
|
||||
<image v-if="!isAgree" @click="isAgree=true" src="@/static/icon/n-check.png"></image>
|
||||
<image v-else @click="isAgree=false" src="@/static/icon/check.png"></image>
|
||||
<view>
|
||||
我已同意<text>《用户协议》</text>与<text>《隐私政策》</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<bindPhone :show="showBind" @close="showBind = false" @change="getPhoneNumber" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onBackPress } from "@dcloudio/uni-app"
|
||||
import { ref } from "vue"
|
||||
import { userLoginApi, userLoginWeixinApi, getMobileByMnpApi } from "@/api/user.js";
|
||||
import useUserStore from "@/store/user.js"
|
||||
import bindPhone from "@/components/bindPhone.vue"
|
||||
import {
|
||||
onBackPress
|
||||
} from "@dcloudio/uni-app"
|
||||
import {
|
||||
ref
|
||||
} from "vue"
|
||||
import {
|
||||
userLoginApi,
|
||||
userLoginWeixinApi,
|
||||
getMobileByMnpApi
|
||||
} from "@/api/user.js";
|
||||
import useUserStore from "@/store/user.js"
|
||||
import bindPhone from "@/components/bindPhone.vue"
|
||||
|
||||
|
||||
|
||||
const navToIndex = () => {
|
||||
if (!userStore.userInfo.supplier) uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
else uni.$u.toast('功能开发中')
|
||||
}
|
||||
const navToIndex = () => {
|
||||
if (!userStore.userInfo.supplier) uni.reLaunch({
|
||||
url: '/pages/index/index'
|
||||
})
|
||||
else uni.navigateTo({
|
||||
url: '/pageQuota/quotation/index'
|
||||
})
|
||||
}
|
||||
|
||||
const userStore = useUserStore(); //使用pinia进行状态管理
|
||||
if (userStore.userInfo && userStore.userInfo.mobile) {
|
||||
navToIndex();
|
||||
} else {
|
||||
userStore.setToken('');
|
||||
userStore.setUserInfo({});
|
||||
}
|
||||
const userStore = useUserStore(); //使用pinia进行状态管理
|
||||
if (userStore.userInfo && userStore.userInfo.mobile) {
|
||||
navToIndex();
|
||||
} else {
|
||||
userStore.setToken('');
|
||||
userStore.setUserInfo({});
|
||||
}
|
||||
|
||||
const showWeixin = ref(true); //是否显示微信登录
|
||||
const isAgree = ref(false); //是否同意协议
|
||||
const showWeixin = ref(true); //是否显示微信登录
|
||||
const isAgree = ref(false); //是否同意协议
|
||||
|
||||
const weixinLogin = () => {
|
||||
if (!isAgree.value) return uni.$u.toast('请先阅读并同意协议');
|
||||
uni.showLoading({
|
||||
title: '登录中'
|
||||
})
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res) => {
|
||||
userLoginWeixinApi({
|
||||
code: res.code
|
||||
}).then(res => {
|
||||
uni.hideLoading();
|
||||
userStore.setToken(res.data.token);
|
||||
userStore.setUserInfo(res.data);
|
||||
if (!res.data.mobile) { //未绑定手机号
|
||||
return showBind.value = true;
|
||||
}
|
||||
navToIndex();
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
uni.$u.toast('登录失败');
|
||||
}
|
||||
})
|
||||
}
|
||||
const weixinLogin = () => {
|
||||
if (!isAgree.value) return uni.$u.toast('请先阅读并同意协议');
|
||||
uni.showLoading({
|
||||
title: '登录中'
|
||||
})
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (res) => {
|
||||
userLoginWeixinApi({
|
||||
code: res.code
|
||||
}).then(res => {
|
||||
uni.hideLoading();
|
||||
userStore.setToken(res.data.token);
|
||||
userStore.setUserInfo(res.data);
|
||||
if (!res.data.mobile) { //未绑定手机号
|
||||
return showBind.value = true;
|
||||
}
|
||||
navToIndex();
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err);
|
||||
uni.$u.toast('登录失败');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const showBind = ref(false); //是否显示绑定手机号弹窗
|
||||
const getPhoneNumber = (e) => {
|
||||
console.log("===", e);
|
||||
if (e.detail?.errMsg == 'getPhoneNumber:ok') {
|
||||
getMobileByMnpApi({
|
||||
code: e.detail.code
|
||||
}).then(res => {
|
||||
navToIndex();
|
||||
})
|
||||
} else {
|
||||
console.log("用户拒绝授权");
|
||||
return uni.$u.toast('您拒绝了授权');
|
||||
}
|
||||
}
|
||||
const showBind = ref(false); //是否显示绑定手机号弹窗
|
||||
const getPhoneNumber = (e) => {
|
||||
console.log("===", e);
|
||||
if (e.detail?.errMsg == 'getPhoneNumber:ok') {
|
||||
getMobileByMnpApi({
|
||||
code: e.detail.code
|
||||
}).then(res => {
|
||||
navToIndex();
|
||||
})
|
||||
} else {
|
||||
console.log("用户拒绝授权");
|
||||
return uni.$u.toast('您拒绝了授权');
|
||||
}
|
||||
}
|
||||
|
||||
const loginForm = ref({
|
||||
phone: '15366662222',
|
||||
code: ''
|
||||
})
|
||||
const isPhone = () => { //检验手机号是否正确
|
||||
loginForm.value.phone = loginForm.value.phone.replace(/\s*/g, ""); //去除空格
|
||||
return !/^1[3456789]\d{9}$/.test(loginForm.value.phone);
|
||||
}
|
||||
const codeLogin = () => {
|
||||
if (!isAgree.value) return uni.$u.toast('请先阅读并同意协议');
|
||||
// 验证码登录
|
||||
if (isPhone()) return uni.$u.toast('请输入正确的手机号码');
|
||||
console.log('登录');
|
||||
userLoginApi({
|
||||
account: '17811111111',
|
||||
password: '1111',
|
||||
terminal: 3,
|
||||
scene: 1
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
})
|
||||
}
|
||||
const loginForm = ref({
|
||||
phone: '15366662222',
|
||||
code: ''
|
||||
})
|
||||
const isPhone = () => { //检验手机号是否正确
|
||||
loginForm.value.phone = loginForm.value.phone.replace(/\s*/g, ""); //去除空格
|
||||
return !/^1[3456789]\d{9}$/.test(loginForm.value.phone);
|
||||
}
|
||||
const codeLogin = () => {
|
||||
if (!isAgree.value) return uni.$u.toast('请先阅读并同意协议');
|
||||
// 验证码登录
|
||||
if (isPhone()) return uni.$u.toast('请输入正确的手机号码');
|
||||
console.log('登录');
|
||||
userLoginApi({
|
||||
account: '17811111111',
|
||||
password: '1111',
|
||||
terminal: 3,
|
||||
scene: 1
|
||||
}).then(res => {
|
||||
console.log(res);
|
||||
})
|
||||
}
|
||||
|
||||
const tips = ref('');
|
||||
const seconds = ref(60);
|
||||
const uCodeRef = ref(null);
|
||||
const tips = ref('');
|
||||
const seconds = ref(60);
|
||||
const uCodeRef = ref(null);
|
||||
|
||||
const codeChange = (text) => {
|
||||
tips.value = text;
|
||||
};
|
||||
const codeChange = (text) => {
|
||||
tips.value = text;
|
||||
};
|
||||
|
||||
const getCode = () => {
|
||||
if (!isAgree.value) return uni.$u.toast('请先阅读并同意协议');
|
||||
if (uCodeRef.value.canGetCode) {
|
||||
if (isPhone()) return uni.$u.toast('请输入正确的手机号码');
|
||||
// 模拟向后端请求验证码
|
||||
uni.showLoading({
|
||||
title: '正在获取验证码',
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
// 这里此提示会被start()方法中的提示覆盖
|
||||
uni.$u.toast('验证码已发送');
|
||||
// 通知验证码组件内部开始倒计时
|
||||
uCodeRef.value.start();
|
||||
}, 2000);
|
||||
} else {
|
||||
uni.$u.toast('倒计时结束后再发送');
|
||||
}
|
||||
};
|
||||
const getCode = () => {
|
||||
if (!isAgree.value) return uni.$u.toast('请先阅读并同意协议');
|
||||
if (uCodeRef.value.canGetCode) {
|
||||
if (isPhone()) return uni.$u.toast('请输入正确的手机号码');
|
||||
// 模拟向后端请求验证码
|
||||
uni.showLoading({
|
||||
title: '正在获取验证码',
|
||||
});
|
||||
setTimeout(() => {
|
||||
uni.hideLoading();
|
||||
// 这里此提示会被start()方法中的提示覆盖
|
||||
uni.$u.toast('验证码已发送');
|
||||
// 通知验证码组件内部开始倒计时
|
||||
uCodeRef.value.start();
|
||||
}, 2000);
|
||||
} else {
|
||||
uni.$u.toast('倒计时结束后再发送');
|
||||
}
|
||||
};
|
||||
|
||||
// 微信小程序无法拦截原生返回按钮,所以使用自定义导航拦截返回
|
||||
const navBack = () => {
|
||||
if (showWeixin.value == false) {
|
||||
showWeixin.value = true;
|
||||
return true;
|
||||
} else uni.navigateBack();
|
||||
}
|
||||
// 微信小程序无法拦截原生返回按钮,所以使用自定义导航拦截返回
|
||||
const navBack = () => {
|
||||
if (showWeixin.value == false) {
|
||||
showWeixin.value = true;
|
||||
return true;
|
||||
} else uni.navigateBack();
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #fff;
|
||||
}
|
||||
page {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.login-box {
|
||||
width: 700rpx;
|
||||
height: 80vh;
|
||||
margin: 0 auto;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding-top: 10vh;
|
||||
position: relative;
|
||||
.login-box {
|
||||
width: 700rpx;
|
||||
height: 80vh;
|
||||
margin: 0 auto;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding-top: 10vh;
|
||||
position: relative;
|
||||
|
||||
.logo {
|
||||
height: 152rpx;
|
||||
width: 152rpx;
|
||||
}
|
||||
.logo {
|
||||
height: 152rpx;
|
||||
width: 152rpx;
|
||||
}
|
||||
|
||||
.tips {
|
||||
color: #444444;
|
||||
font-size: 28rpx;
|
||||
margin: 30rpx 0;
|
||||
}
|
||||
.tips {
|
||||
color: #444444;
|
||||
font-size: 28rpx;
|
||||
margin: 30rpx 0;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 600rpx;
|
||||
margin-top: 40rpx;
|
||||
font-size: 32rpx !important;
|
||||
}
|
||||
.btn {
|
||||
width: 600rpx;
|
||||
margin-top: 40rpx;
|
||||
font-size: 32rpx !important;
|
||||
}
|
||||
|
||||
.form {
|
||||
.input {
|
||||
background-color: #ECFFEE;
|
||||
width: 600rpx;
|
||||
height: 90rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 0 20rpx;
|
||||
margin-bottom: 40rpx;
|
||||
.form {
|
||||
.input {
|
||||
background-color: #ECFFEE;
|
||||
width: 600rpx;
|
||||
height: 90rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 0 20rpx;
|
||||
margin-bottom: 40rpx;
|
||||
|
||||
.place {
|
||||
color: #333;
|
||||
}
|
||||
.place {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.customStyle {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
}
|
||||
.customStyle {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.agreement {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
color: #444;
|
||||
.agreement {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
color: #444;
|
||||
|
||||
image {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
image {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
|
||||
text {
|
||||
color: #20B128;
|
||||
}
|
||||
}
|
||||
}
|
||||
text {
|
||||
color: #20B128;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -24,7 +24,7 @@ const useUserStore = defineStore("user", () => {
|
|||
}
|
||||
|
||||
// #ifdef H5
|
||||
token.value = "0f680a9bc1cdccd7ce588a2a58029411"
|
||||
token.value = "dc1b0fbf7db707502bd127cd02797a6a"
|
||||
// token.value = "95b24dd6d2dda836fe07854b08ba0944"
|
||||
userInfo.value = {
|
||||
avatar: "https://lihaiim.oss-cn-chengdu.aliyuncs.com/image/admin/default_avatar.png",
|
||||
|
@ -34,7 +34,7 @@ const useUserStore = defineStore("user", () => {
|
|||
mobile: "19330904744",
|
||||
nickname: "用户1714964250",
|
||||
supplier: null,
|
||||
token: "b92ad3d7bdc06fa849dfb2c3c8be824e"
|
||||
token: "dc1b0fbf7db707502bd127cd02797a6a"
|
||||
}
|
||||
// #endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue