feat(commission): 支持计奖商品参与设置、独立分成与多规格规则,完善团队中心与微信快捷登录
这个提交包含在:
@@ -0,0 +1,138 @@
|
||||
<!-- 微信小程序手机号一键快捷登录 - mpMobileLogin -->
|
||||
<template>
|
||||
<view class="mp-mobile-login-wrap">
|
||||
<!-- 标题栏 -->
|
||||
<view class="head-box ss-m-b-50">
|
||||
<view class="ss-flex ss-m-b-16">
|
||||
<view class="head-title head-title-animation">手机号快捷登录</view>
|
||||
</view>
|
||||
<view class="head-subtitle">授权微信手机号,享有一键快捷登录体验</view>
|
||||
</view>
|
||||
|
||||
<!-- 微信手机号一键登录主按钮 -->
|
||||
<view class="btn-box ss-m-b-40">
|
||||
<button
|
||||
class="ss-reset-button wechat-quick-btn ss-flex ss-row-center ss-col-center"
|
||||
open-type="getPhoneNumber"
|
||||
@getphonenumber="onGetPhoneNumber"
|
||||
>
|
||||
<text class="cicon-wechat ss-m-r-16 wechat-icon"></text>
|
||||
<text class="btn-text">手机号一键快捷登录</text>
|
||||
</button>
|
||||
</view>
|
||||
|
||||
<!-- 备选切换登录方式 -->
|
||||
<view class="switch-box ss-flex ss-row-center ss-col-center">
|
||||
<view class="switch-item" @tap="showAuthModal('smsLogin')">验证码登录</view>
|
||||
<view class="divider"></view>
|
||||
<view class="switch-item" @tap="showAuthModal('accountLogin')">账号密码登录</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import sheep from '@/sheep';
|
||||
import { showAuthModal, closeAuthModal } from '@/sheep/hooks/useModal';
|
||||
|
||||
const props = defineProps({
|
||||
agreeStatus: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
});
|
||||
|
||||
const emits = defineEmits(['onConfirm']);
|
||||
|
||||
async function onGetPhoneNumber(e) {
|
||||
if (!props.agreeStatus) {
|
||||
emits('onConfirm', true);
|
||||
sheep.$helper.toast('请阅读并勾选协议');
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.detail?.errMsg !== 'getPhoneNumber:ok') {
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showLoading({
|
||||
title: '登录中...',
|
||||
mask: true,
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await sheep.$platform.useProvider('wechat').mobileLogin(e.detail);
|
||||
if (result) {
|
||||
closeAuthModal();
|
||||
await sheep.$store('user').loginAfter();
|
||||
sheep.$helper.toast('登录成功');
|
||||
} else {
|
||||
sheep.$helper.toast('登录失败,请重试');
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('mobileLogin error', err);
|
||||
sheep.$helper.toast('登录异常,请稍后重试');
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '../index.scss';
|
||||
|
||||
.mp-mobile-login-wrap {
|
||||
padding-top: 10rpx;
|
||||
}
|
||||
|
||||
.btn-box {
|
||||
width: 100%;
|
||||
margin-top: 50rpx;
|
||||
}
|
||||
|
||||
.wechat-quick-btn {
|
||||
width: 100%;
|
||||
height: 88rpx;
|
||||
background: #07c160;
|
||||
border-radius: 44rpx;
|
||||
color: #ffffff;
|
||||
box-shadow: 0 8rpx 16rpx rgba(7, 193, 96, 0.25);
|
||||
transition: all 0.2s;
|
||||
|
||||
&:active {
|
||||
opacity: 0.9;
|
||||
transform: scale(0.98);
|
||||
}
|
||||
|
||||
.wechat-icon {
|
||||
font-size: 40rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.btn-text {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
letter-spacing: 1rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.switch-box {
|
||||
margin-top: 36rpx;
|
||||
font-size: 26rpx;
|
||||
color: #888888;
|
||||
|
||||
.switch-item {
|
||||
padding: 10rpx 20rpx;
|
||||
font-size: 26rpx;
|
||||
color: #666666;
|
||||
&:active {
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
}
|
||||
|
||||
.divider {
|
||||
width: 2rpx;
|
||||
height: 24rpx;
|
||||
background-color: #dddddd;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -8,6 +8,13 @@
|
||||
@click="closeAuthModal"
|
||||
/> -->
|
||||
<view class="login-wrap">
|
||||
<!-- 0. 微信小程序手机号一键快捷登录 mpMobileLogin -->
|
||||
<mp-mobile-login
|
||||
v-if="authType === 'mpMobileLogin'"
|
||||
:agreeStatus="state.protocol"
|
||||
@onConfirm="onConfirm"
|
||||
/>
|
||||
|
||||
<!-- 1. 账号密码登录 accountLogin -->
|
||||
<account-login
|
||||
v-if="authType === 'accountLogin'"
|
||||
@@ -56,7 +63,7 @@
|
||||
>立即注册</button
|
||||
>
|
||||
<view class="or-title">或</view>
|
||||
<button class="ss-reset-button login-btn" @tap="thirdLogin('wechat')">快捷登录</button>
|
||||
<button class="ss-reset-button login-btn" @tap="showAuthModal('mpMobileLogin')">快捷登录</button>
|
||||
<view class="circle"></view>
|
||||
</view>
|
||||
|
||||
@@ -99,7 +106,7 @@
|
||||
</view>
|
||||
|
||||
<view
|
||||
v-if="['accountLogin', 'smsLogin', 'smsRegister'].includes(authType)"
|
||||
v-if="['accountLogin', 'smsLogin', 'smsRegister', 'mpMobileLogin'].includes(authType)"
|
||||
class="agreement-box ss-flex ss-row-center"
|
||||
:class="{ shake: currentProtocol }"
|
||||
>
|
||||
@@ -136,6 +143,7 @@
|
||||
<script setup>
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
import sheep from '@/sheep';
|
||||
import mpMobileLogin from './components/mp-mobile-login.vue';
|
||||
import accountLogin from './components/account-login.vue';
|
||||
import smsLogin from './components/sms-login.vue';
|
||||
import smsRegister from './components/sms-register.vue';
|
||||
|
||||
@@ -13,7 +13,11 @@
|
||||
class="menu-icon-wrap ss-flex ss-row-center ss-col-center"
|
||||
@tap="sheep.$router.go(data.url)"
|
||||
>
|
||||
<image class="nav-image" :src="sheep.$url.cdn(data.src)" mode="aspectFit"></image>
|
||||
<image
|
||||
class="nav-image"
|
||||
:src="data.src && data.src.startsWith('/static/') ? data.src : sheep.$url.cdn(data.src)"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
</view>
|
||||
<view class="ss-flex-1" v-if="data.type == 'search'" :style="[{ width: width }]">
|
||||
<s-search-block
|
||||
@@ -55,8 +59,11 @@
|
||||
}
|
||||
|
||||
.menu-icon-wrap {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.nav-image {
|
||||
height: 24px;
|
||||
height: 30px;
|
||||
max-width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -29,15 +29,22 @@
|
||||
<view class="ss-col-bottom">
|
||||
<view
|
||||
v-if="goodsFields.score_price?.show"
|
||||
class="md-goods-price ss-m-t-16 font-OPPOSANS ss-m-r-10 ss-flex"
|
||||
class="md-goods-price ss-m-t-16 font-OPPOSANS ss-m-r-10 ss-flex ss-col-center"
|
||||
:style="[{ color: goodsFields.score_price.color }]"
|
||||
>
|
||||
<view>{{ Number(data.price[0]) > 0 ? '¥' + data.price[0] + '+' : '' }}</view>
|
||||
<view v-if="Number(data.price?.[0] || data.price) > 0">
|
||||
¥{{ data.price?.[0] || data.price }}
|
||||
<text v-if="Number(data.score) > 0">+</text>
|
||||
</view>
|
||||
<image
|
||||
v-if="Number(data.score) > 0"
|
||||
:src="sheep.$url.static('/assets/addons/shopro/uniapp/goods/score1.svg')"
|
||||
class="score-img"
|
||||
></image>
|
||||
{{ data.score }}
|
||||
<text v-if="Number(data.score) > 0">{{ data.score }}</text>
|
||||
<view v-if="Number(data.score) <= 0 && Number(data.price?.[0] || data.price) > 0" class="voucher-sub-tag ss-m-l-8">
|
||||
兑换券
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
@@ -88,15 +95,22 @@
|
||||
<view class="ss-m-t-10">
|
||||
<view
|
||||
v-if="goodsFields.score_price?.show"
|
||||
class="lg-goods-price ss-m-r-12 ss-flex ss-col-bottom font-OPPOSANS"
|
||||
class="lg-goods-price ss-m-r-12 ss-flex ss-col-center font-OPPOSANS"
|
||||
:style="[{ color: goodsFields.score_price.color }]"
|
||||
>
|
||||
<view>{{ Number(data.price[0]) > 0 ? '¥' + data.price[0] + '+' : '' }}</view>
|
||||
<view v-if="Number(data.price?.[0] || data.price) > 0">
|
||||
¥{{ data.price?.[0] || data.price }}
|
||||
<text v-if="Number(data.score) > 0">+</text>
|
||||
</view>
|
||||
<image
|
||||
v-if="Number(data.score) > 0"
|
||||
:src="sheep.$url.static('/assets/addons/shopro/uniapp/goods/score1.svg')"
|
||||
class="score-img"
|
||||
></image>
|
||||
{{ data.score }}
|
||||
<text v-if="Number(data.score) > 0">{{ data.score }}</text>
|
||||
<view v-if="Number(data.score) <= 0 && Number(data.price?.[0] || data.price) > 0" class="voucher-sub-tag ss-m-l-8">
|
||||
兑换券
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="goodsFields.price?.show && data.original_price > 0"
|
||||
@@ -146,13 +160,20 @@
|
||||
</view>
|
||||
</slot>
|
||||
<view class="ss-flex ss-col-bottom ss-p-l-16 ss-p-r-16 font-OPPOSANS">
|
||||
<view class="sl-goods-price ss-m-r-12 ss-flex">
|
||||
<view>{{ Number(data.price[0]) > 0 ? '¥' + data.price[0] + '+' : '' }}</view>
|
||||
<view class="sl-goods-price ss-m-r-12 ss-flex ss-col-center">
|
||||
<view v-if="Number(data.price?.[0] || data.price) > 0">
|
||||
¥{{ data.price?.[0] || data.price }}
|
||||
<text v-if="Number(data.score) > 0">+</text>
|
||||
</view>
|
||||
<image
|
||||
v-if="Number(data.score) > 0"
|
||||
:src="sheep.$url.static('/assets/addons/shopro/uniapp/goods/score1.svg')"
|
||||
class="score-img"
|
||||
></image>
|
||||
<view>{{ data.score ? data.score : '' }}</view>
|
||||
<view v-if="Number(data.score) > 0">{{ data.score }}</view>
|
||||
<view v-if="Number(data.score) <= 0 && Number(data.price?.[0] || data.price) > 0" class="voucher-sub-tag ss-m-l-8">
|
||||
兑换券
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="data.original_price > 0"
|
||||
@@ -454,4 +475,13 @@
|
||||
height: 36rpx;
|
||||
margin: 0 4rpx;
|
||||
}
|
||||
.voucher-sub-tag {
|
||||
font-size: 20rpx;
|
||||
color: #ff3000;
|
||||
background: rgba(255, 48, 0, 0.1);
|
||||
border: 1rpx solid rgba(255, 48, 0, 0.25);
|
||||
border-radius: 6rpx;
|
||||
padding: 2rpx 8rpx;
|
||||
line-height: normal;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -2,15 +2,12 @@
|
||||
<template>
|
||||
<view class="ss-user-info-wrap ss-p-t-50">
|
||||
<view class="ss-flex ss-col-center ss-row-between ss-m-b-20">
|
||||
<view class="left-box ss-flex ss-col-center ss-m-l-36">
|
||||
<!-- 已登录状态 -->
|
||||
<view v-if="isLogin" class="left-box ss-flex ss-col-center ss-m-l-36">
|
||||
<view class="avatar-box ss-m-r-24">
|
||||
<image
|
||||
class="avatar-img"
|
||||
:src="
|
||||
isLogin
|
||||
? sheep.$url.cdn(userInfo.avatar)
|
||||
: sheep.$url.static('/assets/addons/shopro/uniapp/default_avatar.png')
|
||||
"
|
||||
:src="sheep.$url.cdn(userInfo.avatar)"
|
||||
mode="aspectFill"
|
||||
@tap="sheep.$router.go('/pages/user/info')"
|
||||
></image>
|
||||
@@ -20,7 +17,7 @@
|
||||
<view class="nick-name ss-m-r-20">{{ userInfo?.nickname || nickname }}</view>
|
||||
</view>
|
||||
<view
|
||||
v-if="isLogin && showIdentityBadges"
|
||||
v-if="showIdentityBadges"
|
||||
class="identity-row ss-flex ss-col-center ss-flex-wrap"
|
||||
@tap="onBadgeTap"
|
||||
>
|
||||
@@ -32,6 +29,55 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 未登录状态:微信小程序原生手机号快捷登录按钮 -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<button
|
||||
v-else
|
||||
class="ss-reset-button left-box ss-flex ss-col-center ss-m-l-36 unlogin-btn"
|
||||
open-type="getPhoneNumber"
|
||||
@getphonenumber="onQuickLogin"
|
||||
>
|
||||
<view class="avatar-box ss-m-r-24">
|
||||
<image
|
||||
class="avatar-img"
|
||||
:src="sheep.$url.static('/assets/addons/shopro/uniapp/default_avatar.png')"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</view>
|
||||
<view class="user-meta">
|
||||
<view class="nickname-box ss-flex ss-col-center">
|
||||
<view class="nick-name ss-m-r-20">点击登录</view>
|
||||
</view>
|
||||
<view class="quick-login-badge ss-flex ss-col-center">
|
||||
<text class="cicon-wechat ss-m-r-8"></text>
|
||||
<text class="quick-badge-text">手机号快捷登录</text>
|
||||
</view>
|
||||
</view>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
|
||||
<!-- 未登录状态:其他平台普通点击呼出弹窗 -->
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<view
|
||||
v-else
|
||||
class="left-box ss-flex ss-col-center ss-m-l-36"
|
||||
@tap="showAuthModal()"
|
||||
>
|
||||
<view class="avatar-box ss-m-r-24">
|
||||
<image
|
||||
class="avatar-img"
|
||||
:src="sheep.$url.static('/assets/addons/shopro/uniapp/default_avatar.png')"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</view>
|
||||
<view class="user-meta">
|
||||
<view class="nickname-box ss-flex ss-col-center">
|
||||
<view class="nick-name ss-m-r-20">{{ nickname }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<view class="right-box ss-m-r-52">
|
||||
<button class="ss-reset-button" @tap="showShareModal">
|
||||
<text class="sicon-qrcode"></text>
|
||||
@@ -41,13 +87,24 @@
|
||||
|
||||
<view
|
||||
class="bind-mobile-box ss-flex ss-row-between ss-col-center"
|
||||
v-if="isLogin && !userInfo.verification?.mobile"
|
||||
v-if="showBindMobile"
|
||||
>
|
||||
<view class="ss-flex">
|
||||
<text class="cicon-mobile-o"></text>
|
||||
<view class="mobile-title ss-m-l-20"> 点击绑定手机号确保账户安全 </view>
|
||||
</view>
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<button
|
||||
class="ss-reset-button bind-btn"
|
||||
open-type="getPhoneNumber"
|
||||
@getphonenumber="onBindPhoneNumber"
|
||||
>
|
||||
去绑定
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifndef MP-WEIXIN -->
|
||||
<button class="ss-reset-button bind-btn" @tap="onBind">去绑定</button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -158,10 +215,50 @@
|
||||
hasPartner.value,
|
||||
);
|
||||
|
||||
const hasBoundMobile = computed(() => {
|
||||
return Boolean(userInfo.value?.mobile || userInfo.value?.verification?.mobile);
|
||||
});
|
||||
|
||||
const showBindMobile = computed(() => {
|
||||
// 1. 未登录不展示
|
||||
if (!isLogin.value) return false;
|
||||
// 2. 存在已绑定手机号不展示
|
||||
if (hasBoundMobile.value) return false;
|
||||
// 3. 微信小程序环境:默认手机号快捷登录体系,不展示此冗余横幅
|
||||
// #ifdef MP-WEIXIN
|
||||
return false;
|
||||
// #endif
|
||||
// 4. 其他环境:受平台设置“绑定手机号”开关控制
|
||||
return Boolean(sheep.$store('app').platform?.bind_mobile);
|
||||
});
|
||||
|
||||
function onBind() {
|
||||
showAuthModal('changeMobile');
|
||||
}
|
||||
|
||||
// 微信小程序一键快捷绑定手机号
|
||||
async function onBindPhoneNumber(e) {
|
||||
if (e.detail?.errMsg !== 'getPhoneNumber:ok') {
|
||||
showAuthModal('changeMobile');
|
||||
return;
|
||||
}
|
||||
uni.showLoading({ title: '绑定中...', mask: true });
|
||||
try {
|
||||
const result = await sheep.$platform.useProvider('wechat').bindUserPhoneNumber(e.detail);
|
||||
if (result) {
|
||||
await sheep.$store('user').getInfo();
|
||||
sheep.$helper.toast('绑定成功');
|
||||
} else {
|
||||
showAuthModal('changeMobile');
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('onBindPhoneNumber error', err);
|
||||
showAuthModal('changeMobile');
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
}
|
||||
|
||||
function onBadgeTap() {
|
||||
if (!isLogin.value) {
|
||||
showAuthModal();
|
||||
@@ -169,12 +266,71 @@
|
||||
}
|
||||
sheep.$router.go('/pages/commission/index');
|
||||
}
|
||||
|
||||
// 微信小程序手机号一键快捷登录
|
||||
async function onQuickLogin(e) {
|
||||
if (e.detail?.errMsg !== 'getPhoneNumber:ok') {
|
||||
showAuthModal();
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showLoading({
|
||||
title: '登录中...',
|
||||
mask: true,
|
||||
});
|
||||
|
||||
try {
|
||||
const result = await sheep.$platform.useProvider('wechat').mobileLogin(e.detail);
|
||||
if (result) {
|
||||
await sheep.$store('user').loginAfter();
|
||||
sheep.$helper.toast('登录成功');
|
||||
} else {
|
||||
sheep.$helper.toast('登录失败,请重试');
|
||||
showAuthModal();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('onQuickLogin error', err);
|
||||
sheep.$helper.toast('登录异常,请稍后重试');
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.ss-user-info-wrap {
|
||||
box-sizing: border-box;
|
||||
|
||||
.unlogin-btn {
|
||||
text-align: left;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.quick-login-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin-top: 8rpx;
|
||||
padding: 4rpx 14rpx;
|
||||
font-size: 20rpx;
|
||||
line-height: 28rpx;
|
||||
color: #07c160;
|
||||
background: rgba(7, 193, 96, 0.1);
|
||||
border-radius: 20rpx;
|
||||
border: 1rpx solid rgba(7, 193, 96, 0.25);
|
||||
|
||||
.cicon-wechat {
|
||||
font-size: 24rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.quick-badge-text {
|
||||
font-size: 20rpx;
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
|
||||
.avatar-box {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
|
||||
在新工单中引用
屏蔽一个用户