feat(提现)
This commit is contained in:
parent
4f1a9a3440
commit
69aa02da78
14
pages.json
14
pages.json
|
@ -101,6 +101,20 @@
|
|||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "pages/user",
|
||||
"pages": [
|
||||
{
|
||||
"path": "wallet/money",
|
||||
"style": {
|
||||
"navigationBarTitleText": "余额"
|
||||
},
|
||||
"meta": {
|
||||
"auth": false
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"tabBar": {
|
||||
|
|
|
@ -6,32 +6,15 @@
|
|||
</view>
|
||||
<uni-forms ref="smsLoginRef" v-model="state.model" :rules="state.rules" validateTrigger="bind">
|
||||
<uni-forms-item name="mobile">
|
||||
<uni-easyinput
|
||||
:styles="state.inputStyle"
|
||||
trim="all"
|
||||
placeholder="请输入手机号"
|
||||
v-model="state.model.mobile"
|
||||
:inputBorder="false"
|
||||
type="number"
|
||||
/>
|
||||
<uni-easyinput :styles="state.inputStyle" trim="all" placeholder="请输入手机号" v-model="state.model.mobile"
|
||||
:inputBorder="false" type="number" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item name="code">
|
||||
<uni-easyinput
|
||||
:styles="state.inputStyle"
|
||||
trim="all"
|
||||
placeholder="验证码"
|
||||
v-model="state.model.code"
|
||||
:inputBorder="false"
|
||||
type="number"
|
||||
maxlength="4"
|
||||
>
|
||||
<uni-easyinput :styles="state.inputStyle" trim="all" placeholder="验证码" v-model="state.model.code"
|
||||
:inputBorder="false" type="number" maxlength="4">
|
||||
<template #right>
|
||||
<button
|
||||
:disabled="state.isMobileEnd"
|
||||
:class="{ 'code-btn-end': state.isMobileEnd }"
|
||||
class="ss-reset-button code-btn code-btn-start"
|
||||
@tap="getSmsCode('smsLogin', state.model.mobile)"
|
||||
>
|
||||
<button :disabled="state.isMobileEnd" :class="{ 'code-btn-end': state.isMobileEnd }"
|
||||
class="ss-reset-button code-btn code-btn-start" @tap="getSmsCode('smsLogin', state.model.mobile)">
|
||||
{{ getSmsTimer('smsLogin') }}
|
||||
</button>
|
||||
</template>
|
||||
|
@ -41,12 +24,8 @@
|
|||
<button class="ss-reset-button login-btn-start" @tap="smsLoginSubmit">登录</button>
|
||||
<view class="agreement-box ss-flex ss-row-center" :class="{ shake: state.isShaking }">
|
||||
<label class="radio ss-flex" @tap="onChange">
|
||||
<radio
|
||||
:checked="state.agreeStatus"
|
||||
color="var(--ui-BG-Main)"
|
||||
style="transform: scale(0.8)"
|
||||
@tap.stop="onChange"
|
||||
/>
|
||||
<radio :checked="state.agreeStatus" color="var(--ui-BG-Main)" style="transform: scale(0.8)"
|
||||
@tap.stop="onChange" />
|
||||
<view class="agreement-text ss-flex ss-m-l-8">
|
||||
我已阅读并遵守
|
||||
<view class="tcp-text" @tap.stop="onProtocol('商家入驻协议')"> 《商家入驻协议》 </view>
|
||||
|
@ -88,6 +67,10 @@ function onChange() {
|
|||
state.value.agreeStatus = !state.value.agreeStatus
|
||||
}
|
||||
|
||||
function onProtocol() {
|
||||
peach.$router.go('/pages/public/richtext?title=商家入驻协议')
|
||||
}
|
||||
|
||||
async function smsLoginSubmit() {
|
||||
const validate = await smsLoginRef.value.validate().catch((err) => {
|
||||
console.log('err', err)
|
||||
|
|
|
@ -1,43 +1,24 @@
|
|||
<!-- 我的钱包 -->
|
||||
<template>
|
||||
<pb-layout navbar="inner" class="wallet-wrap" title="钱包" :bgStyle="bgStyle">
|
||||
<!-- 钱包卡片 -->
|
||||
<view class="header-box ss-flex ss-row-center ss-col-center">
|
||||
<view class="card-box ui-BG-Main ui-Shadow-Main">
|
||||
<pb-layout navbar="inner" class="wallet-wrap" color="#fff" title="余额" :bgStyle="bgStyle">
|
||||
<view class="header-box ss-row-center ss-col-center">
|
||||
<view class="card-box ui-BG-Main ui-Shadow-Main ss-flex ss-row-between ss-col-center">
|
||||
<view class="ss-flex ss-flex-col ss-row-between ss-col-top ss-gap-40">
|
||||
<view class="card-head ss-flex ss-col-center">
|
||||
<view class="card-title ss-m-r-10">钱包余额(元)</view>
|
||||
<view
|
||||
@tap="state.showMoney = !state.showMoney"
|
||||
class="ss-eye-icon"
|
||||
:class="state.showMoney ? 'cicon-eye' : 'cicon-eye-off'"
|
||||
/>
|
||||
<view class="card-title ss-m-r-10">账户余额(元)</view>
|
||||
<view @tap="state.showMoney = !state.showMoney" class="ss-eye-icon"
|
||||
:class="state.showMoney ? 'cicon-eye' : 'cicon-eye-off'" />
|
||||
</view>
|
||||
<view class="ss-flex ss-row-between ss-col-center ss-m-t-64">
|
||||
|
||||
<view class="money-num">{{ state.showMoney ? fen2yuan(userWallet.balance) : '*****' }}</view>
|
||||
<button class="ss-reset-button topup-btn" @tap="peach.$router.go('/pages/pay/recharge')">
|
||||
充值
|
||||
</button>
|
||||
</view>
|
||||
<button class="ss-reset-button topup-btn" @tap="peach.$router.go('/pages/pay/recharge')">
|
||||
提现
|
||||
</button>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<su-sticky>
|
||||
<!-- 统计 -->
|
||||
<view class="filter-box ss-p-x-30 ss-flex ss-col-center ss-row-between">
|
||||
<uni-datetime-picker v-model="state.data" type="daterange" @change="onChangeTime" :end="state.today">
|
||||
<button class="ss-reset-button date-btn">
|
||||
<text>{{ dateFilterText }}</text>
|
||||
<text class="cicon-drop-down ss-seldate-icon"></text>
|
||||
</button>
|
||||
</uni-datetime-picker>
|
||||
<view class="total-box">
|
||||
<view class="ss-m-b-10">总收入¥{{ fen2yuan(state.summary.totalIncome) }}</view>
|
||||
<view>总支出¥{{ fen2yuan(state.summary.totalExpense) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<su-tabs :list="tabMaps" @change="onChange" :scrollable="false" :current="state.currentTab"></su-tabs>
|
||||
</su-sticky>
|
||||
<s-empty v-if="state.pagination.total === 0" text="暂无数据" icon="/static/data-empty.png" />
|
||||
|
||||
<p-empty v-if="state.pagination.total === 0" :marginTop="40" text="暂无数据" icon="/static/data-empty.png" />
|
||||
|
||||
<!-- 钱包记录 -->
|
||||
<view v-if="state.pagination.total > 0">
|
||||
|
@ -58,13 +39,9 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<uni-load-more
|
||||
v-if="state.pagination.total > 0"
|
||||
:status="state.loadStatus"
|
||||
:content-text="{
|
||||
<uni-load-more v-if="state.pagination.total > 0" :status="state.loadStatus" :content-text="{
|
||||
contentdown: '上拉加载更多',
|
||||
}"
|
||||
/>
|
||||
}" />
|
||||
</pb-layout>
|
||||
</template>
|
||||
|
||||
|
@ -76,7 +53,7 @@ import dayjs from 'dayjs'
|
|||
import _ from 'lodash'
|
||||
import PayWalletApi from '@/peach/api/pay/wallet'
|
||||
import { fen2yuan } from '@/peach/hooks/useGoods'
|
||||
import { resetPagination } from '@/peach/util'
|
||||
import { resetPagination } from '@/peach/utils'
|
||||
|
||||
const bgStyle = {
|
||||
backgroundImage: '/static/bg-page.png',
|
||||
|
@ -85,109 +62,45 @@ const bgStyle = {
|
|||
description: '',
|
||||
}
|
||||
|
||||
const headerBg = peach.$url.css('/static/img/shop/user/wallet_card_bg.png')
|
||||
// const headerBg = peach.$url.css('/static/img/shop/user/wallet_card_bg.png')
|
||||
|
||||
// 数据
|
||||
const state = reactive({
|
||||
showMoney: false,
|
||||
date: [], // 筛选的时间段
|
||||
currentTab: 0,
|
||||
pagination: {
|
||||
list: [],
|
||||
total: 0,
|
||||
pageNo: 1,
|
||||
pageSize: 8,
|
||||
},
|
||||
summary: {
|
||||
totalIncome: 0,
|
||||
totalExpense: 0,
|
||||
},
|
||||
loadStatus: '',
|
||||
today: '',
|
||||
})
|
||||
|
||||
const tabMaps = [
|
||||
{
|
||||
name: '全部',
|
||||
value: '',
|
||||
},
|
||||
{
|
||||
name: '收入',
|
||||
value: '1',
|
||||
},
|
||||
{
|
||||
name: '支出',
|
||||
value: '2',
|
||||
},
|
||||
]
|
||||
|
||||
const userWallet = computed(() => peach.$store('user').userWallet)
|
||||
|
||||
// 格式化时间段
|
||||
const dateFilterText = computed(() => {
|
||||
if (state.date[0] === state.date[1]) {
|
||||
return state.date[0]
|
||||
} else {
|
||||
return state.date.join('~')
|
||||
}
|
||||
})
|
||||
|
||||
// 获得钱包记录分页
|
||||
async function getLogList() {
|
||||
state.loadStatus = 'loading'
|
||||
const { data, code } = await PayWalletApi.getWalletTransactionPage({
|
||||
pageNo: state.pagination.pageNo,
|
||||
pageSize: state.pagination.pageSize,
|
||||
type: tabMaps[state.currentTab].value,
|
||||
'createTime[0]': state.date[0] + ' 00:00:00',
|
||||
'createTime[1]': state.date[1] + ' 23:59:59',
|
||||
})
|
||||
if (code !== 0) {
|
||||
return
|
||||
}
|
||||
state.pagination.list = _.concat(state.pagination.list, data.list)
|
||||
state.pagination.total = data.total
|
||||
state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore'
|
||||
// const { data, code } = await PayWalletApi.getWalletTransactionPage({
|
||||
// pageNo: state.pagination.pageNo,
|
||||
// pageSize: state.pagination.pageSize,
|
||||
|
||||
// })
|
||||
|
||||
// state.pagination.list = _.concat(state.pagination.list, data.list)
|
||||
// state.pagination.total = data.total
|
||||
// state.loadStatus = state.pagination.list.length < state.pagination.total ? 'more' : 'noMore'
|
||||
}
|
||||
|
||||
// 获得钱包统计
|
||||
async function getSummary() {
|
||||
const { data, code } = await PayWalletApi.getWalletTransactionSummary({
|
||||
createTime: [state.date[0] + ' 00:00:00', state.date[1] + ' 23:59:59'],
|
||||
})
|
||||
if (code !== 0) {
|
||||
return
|
||||
}
|
||||
state.summary = data
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
state.today = dayjs().format('YYYY-MM-DD')
|
||||
state.date = [state.today, state.today]
|
||||
getLogList()
|
||||
getSummary()
|
||||
// 刷新钱包的缓存
|
||||
peach.$store('user').getWallet()
|
||||
// peach.$store('user').getWallet()
|
||||
})
|
||||
|
||||
// 处理 tab 切换
|
||||
function onChange(e) {
|
||||
state.currentTab = e.index
|
||||
// 重新加载列表
|
||||
resetPagination(state.pagination)
|
||||
getLogList()
|
||||
getSummary()
|
||||
}
|
||||
|
||||
// 处理时间筛选
|
||||
function onChangeTime(e) {
|
||||
state.date[0] = e[0]
|
||||
state.date[1] = e[e.length - 1]
|
||||
// 重新加载列表
|
||||
resetPagination(state.pagination)
|
||||
getLogList()
|
||||
getSummary()
|
||||
}
|
||||
|
||||
onReachBottom(() => {
|
||||
if (state.loadStatus === 'noMore') {
|
||||
|
@ -199,15 +112,11 @@ onReachBottom(() => {
|
|||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 钱包
|
||||
.header-box {
|
||||
background-color: $white;
|
||||
padding: 30rpx;
|
||||
|
||||
.card-box {
|
||||
width: 100%;
|
||||
min-height: 300rpx;
|
||||
padding: 40rpx;
|
||||
min-height: 250rpx;
|
||||
padding: 0 40rpx;
|
||||
background-size: 100% 100%;
|
||||
border-radius: 30rpx;
|
||||
overflow: hidden;
|
||||
|
@ -215,19 +124,6 @@ onReachBottom(() => {
|
|||
z-index: 1;
|
||||
box-sizing: border-box;
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: v-bind(headerBg) no-repeat;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.card-head {
|
||||
color: $white;
|
||||
font-size: 30rpx;
|
||||
|
@ -253,7 +149,7 @@ onReachBottom(() => {
|
|||
}
|
||||
|
||||
.topup-btn {
|
||||
width: 120rpx;
|
||||
width: 150rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
border-radius: 30px;
|
||||
|
@ -293,11 +189,6 @@ onReachBottom(() => {
|
|||
}
|
||||
}
|
||||
|
||||
.tabs-box {
|
||||
background: $white;
|
||||
border-bottom: 2rpx solid #eeeeee;
|
||||
}
|
||||
|
||||
// tab
|
||||
.wallet-tab-card {
|
||||
.tab-item {
|
||||
|
@ -358,6 +249,7 @@ onReachBottom(() => {
|
|||
font-size: 28rpx;
|
||||
font-weight: bold;
|
||||
font-family: OPPOSANS;
|
||||
|
||||
.add {
|
||||
color: var(--ui-BG-Main);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
import request from "@/peach/request";
|
||||
|
||||
const PayWalletApi = {
|
||||
getWalletTransactionPage: () => {},
|
||||
};
|
||||
|
||||
export default PayWalletApi;
|
|
@ -1,6 +1,9 @@
|
|||
<template>
|
||||
<view class="ss-flex-col ss-col-center ss-row-center empty-box" :style="[{ paddingTop: paddingTop + 'rpx' }]">
|
||||
<view class=""><image class="empty-icon" :src="icon" mode="widthFix"></image></view>
|
||||
<view class="ss-flex-col ss-col-center ss-row-center empty-box"
|
||||
:style="[{ paddingTop: paddingTop + 'rpx', backgroundColor: bgColor, marginTop: marginTop + 'rpx' }]">
|
||||
<view class="">
|
||||
<image class="empty-icon" :src="icon" mode="widthFix"></image>
|
||||
</view>
|
||||
<view class="empty-text ss-m-t-28 ss-m-b-40">
|
||||
<text v-if="text !== ''">{{ text }}</text>
|
||||
</view>
|
||||
|
@ -49,6 +52,14 @@ const props = defineProps({
|
|||
type: String,
|
||||
default: 'var(--ui-BG-Main)',
|
||||
},
|
||||
bgColor: {
|
||||
type: String,
|
||||
default: '#ffffff',
|
||||
},
|
||||
marginTop: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
})
|
||||
|
||||
const emits = defineEmits(['clickAction'])
|
||||
|
@ -65,6 +76,7 @@ function clickAction() {
|
|||
.empty-box {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.empty-icon {
|
||||
width: 240rpx;
|
||||
}
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
import { ref } from 'vue'
|
||||
import { defineStore } from 'pinia'
|
||||
import $share from '@/peach/platform/share'
|
||||
import $router from '@/peach/router'
|
||||
import UserUtil from '@/peach/api/member/user'
|
||||
import { isEmpty, cloneDeep, clone } from 'lodash'
|
||||
import { ref } from "vue";
|
||||
import { defineStore } from "pinia";
|
||||
import $share from "@/peach/platform/share";
|
||||
import $router from "@/peach/router";
|
||||
import UserUtil from "@/peach/api/member/user";
|
||||
import { isEmpty, cloneDeep, clone } from "lodash";
|
||||
|
||||
// 默认用户信息
|
||||
const defaultUserInfo = {
|
||||
avatar: '', // 头像
|
||||
nickname: '', // 昵称
|
||||
mobile: '', // 手机号
|
||||
avatar: "", // 头像
|
||||
nickname: "", // 昵称
|
||||
mobile: "", // 手机号
|
||||
point: 0, // 积分
|
||||
particulars: null,
|
||||
}
|
||||
};
|
||||
|
||||
// 默认钱包信息
|
||||
const defaultWallet = {
|
||||
balance: 0, // 余额
|
||||
totalExpense: 0, // 总消费
|
||||
totalRecharge: 0, // 总充值
|
||||
}
|
||||
};
|
||||
|
||||
// 默认订单信息
|
||||
const defaultNumData = {
|
||||
|
@ -32,93 +32,94 @@ const defaultNumData = {
|
|||
uncommentedCount: 0,
|
||||
afterSaleCount: 0,
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
const useUserStore = defineStore(
|
||||
'user',
|
||||
"user",
|
||||
() => {
|
||||
const userInfo = ref(cloneDeep(defaultUserInfo))
|
||||
const userWallet = ref(clone(defaultWallet))
|
||||
const userNumData = ref(cloneDeep(defaultNumData))
|
||||
const isLogin = ref(!!uni.getStorageSync('token'))
|
||||
const lastUpdateTime = ref(0)
|
||||
const lastRoutePage = ref(null)
|
||||
const userInfo = ref(cloneDeep(defaultUserInfo));
|
||||
const userWallet = ref(clone(defaultWallet));
|
||||
const userNumData = ref(cloneDeep(defaultNumData));
|
||||
const isLogin = ref(!!uni.getStorageSync("token"));
|
||||
const lastUpdateTime = ref(0);
|
||||
const lastRoutePage = ref(null);
|
||||
|
||||
async function getUserInfo() {
|
||||
let res = await UserUtil.getUserInfo()
|
||||
userInfo.value = res.data
|
||||
let res = await UserUtil.getUserInfo();
|
||||
userInfo.value = res.data;
|
||||
}
|
||||
|
||||
async function getWallet() {
|
||||
let res = await UserUtil.getWalletInfo()
|
||||
userWallet.value = res.data
|
||||
let res = await UserUtil.getWalletInfo();
|
||||
userWallet.value = res.data;
|
||||
}
|
||||
|
||||
function getNumData() {}
|
||||
|
||||
function setToken(token, refreshToken) {
|
||||
if (token === '') {
|
||||
isLogin.value = false
|
||||
uni.removeStorageSync('token')
|
||||
uni.removeStorageSync('refresh-token')
|
||||
if (token === "") {
|
||||
isLogin.value = false;
|
||||
uni.removeStorageSync("token");
|
||||
uni.removeStorageSync("refresh-token");
|
||||
} else {
|
||||
isLogin.value = true
|
||||
uni.setStorageSync('token', token)
|
||||
uni.setStorageSync('refresh-token', refreshToken)
|
||||
isLogin.value = true;
|
||||
uni.setStorageSync("token", token);
|
||||
uni.setStorageSync("refresh-token", refreshToken);
|
||||
// 成功后处理
|
||||
loginAfter()
|
||||
loginAfter();
|
||||
}
|
||||
return isLogin.value
|
||||
return isLogin.value;
|
||||
}
|
||||
|
||||
function resetUserData() {
|
||||
setToken('')
|
||||
userInfo.value = cloneDeep(defaultUserInfo)
|
||||
userWallet.value = clone(defaultWallet)
|
||||
userNumData.value = cloneDeep(defaultNumData)
|
||||
setToken("");
|
||||
userInfo.value = cloneDeep(defaultUserInfo);
|
||||
userWallet.value = clone(defaultWallet);
|
||||
userNumData.value = cloneDeep(defaultNumData);
|
||||
}
|
||||
|
||||
async function updateUserData() {
|
||||
const nowTime = new Date().getTime()
|
||||
const nowTime = new Date().getTime();
|
||||
if (lastUpdateTime.value + 5000 > nowTime) {
|
||||
return
|
||||
return;
|
||||
}
|
||||
lastUpdateTime.value = nowTime
|
||||
await Promise.all([getUserInfo(), getWallet(), getNumData()])
|
||||
return userInfo.value
|
||||
lastUpdateTime.value = nowTime;
|
||||
await Promise.all([getUserInfo(), getWallet(), getNumData()]);
|
||||
return userInfo.value;
|
||||
}
|
||||
|
||||
async function loginAfter() {
|
||||
await updateUserData()
|
||||
$share.getShareInfo()
|
||||
$router.go('/pages/index/index')
|
||||
await updateUserData();
|
||||
$share.getShareInfo();
|
||||
$router.go("/pages/index/index");
|
||||
}
|
||||
|
||||
function logOut() {
|
||||
resetUserData()
|
||||
return !isLogin.value
|
||||
resetUserData();
|
||||
return !isLogin.value;
|
||||
}
|
||||
|
||||
return {
|
||||
userInfo,
|
||||
userWallet,
|
||||
isLogin,
|
||||
lastRoutePage,
|
||||
setToken,
|
||||
logOut,
|
||||
loginAfter,
|
||||
lastRoutePage,
|
||||
}
|
||||
getWallet,
|
||||
};
|
||||
},
|
||||
{
|
||||
persist: {
|
||||
enabled: true,
|
||||
strategies: [
|
||||
{
|
||||
key: 'user-store',
|
||||
key: "user-store",
|
||||
},
|
||||
],
|
||||
},
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
export default useUserStore
|
||||
export default useUserStore;
|
||||
|
|
|
@ -1,24 +1,11 @@
|
|||
<template>
|
||||
<pb-fixed
|
||||
:noFixed="props.noFixed"
|
||||
:alway="props.alway"
|
||||
:bgStyles="props.bgStyles"
|
||||
:val="0"
|
||||
:index="props.zIndex"
|
||||
noNav
|
||||
:bg="props.bg"
|
||||
:ui="props.ui"
|
||||
:opacity="props.opacity"
|
||||
:placeholder="props.placeholder"
|
||||
>
|
||||
<pb-fixed :noFixed="props.noFixed" :alway="props.alway" :bgStyles="props.bgStyles" :val="0" :index="props.zIndex"
|
||||
noNav :bg="props.bg" :ui="props.ui" :opacity="props.opacity" :placeholder="props.placeholder">
|
||||
<pb-status-bar />
|
||||
|
||||
<view class="ui-navbar-box">
|
||||
<view
|
||||
class="ui-bar ss-p-x-20"
|
||||
:class="state.isDark ? 'text-white' : 'text-black'"
|
||||
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]"
|
||||
>
|
||||
<view class="ui-bar ss-p-x-20" :class="state.isDark ? 'text-white' : 'text-black'"
|
||||
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]">
|
||||
<view v-if="leftIcon" class="icon-box ss-flex">
|
||||
<view class="icon-button icon-button-left ss-flex ss-row-center" @tap="onClickLeft">
|
||||
<text class="sicon-back" v-if="hasHistory" />
|
||||
|
@ -30,7 +17,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<slot name="center">
|
||||
<view class="center navbar-title">{{ title }}</view>
|
||||
<view :style="{ color: themeColor }" class="center navbar-title">{{ title }}</view>
|
||||
</slot>
|
||||
<!-- #ifdef MP -->
|
||||
<view :style="[state.capsuleStyle]"></view>
|
||||
|
@ -74,9 +61,17 @@ const state = reactive({
|
|||
})
|
||||
|
||||
const sys_statusBar = peach.$platform.device.statusBarHeight
|
||||
const sys_navBar = peach.$platform.navbar
|
||||
const sys_navBar = peach.$platform.navBar
|
||||
|
||||
const props = defineProps({
|
||||
dark: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
color: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
zIndex: {
|
||||
type: Number,
|
||||
default: 100,
|
||||
|
@ -130,13 +125,20 @@ const props = defineProps({
|
|||
},
|
||||
bgStyles: {
|
||||
type: Object,
|
||||
default() {},
|
||||
default() { },
|
||||
},
|
||||
})
|
||||
|
||||
const emits = defineEmits(['navback', 'clickLeft'])
|
||||
const hasHistory = peach.$router.hasHistory()
|
||||
|
||||
const themeColor = computed(() => {
|
||||
if (props.dark) {
|
||||
return props.color ? props.color : '#fff'
|
||||
}
|
||||
return props.color || '#333'
|
||||
})
|
||||
|
||||
onBeforeMount(() => {
|
||||
init()
|
||||
})
|
||||
|
@ -180,39 +182,49 @@ const init = () => {
|
|||
height: 56rpx;
|
||||
margin-left: 8rpx;
|
||||
border: 1px solid rgba(#fff, 0.4);
|
||||
|
||||
.line {
|
||||
width: 2rpx;
|
||||
height: 24rpx;
|
||||
background: #e5e5e7;
|
||||
}
|
||||
|
||||
.sicon-back {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.sicon-home {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.sicon-more {
|
||||
font-size: 32rpx;
|
||||
}
|
||||
|
||||
.icon-button {
|
||||
width: 67rpx;
|
||||
height: 56rpx;
|
||||
|
||||
&-left:hover {
|
||||
background: rgba(0, 0, 0, 0.16);
|
||||
border-radius: 30rpx 0px 0px 30rpx;
|
||||
}
|
||||
|
||||
&-right:hover {
|
||||
background: rgba(0, 0, 0, 0.16);
|
||||
border-radius: 0px 30rpx 30rpx 0px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.navbar-title {
|
||||
font-size: 36rpx;
|
||||
}
|
||||
|
||||
.tools-icon {
|
||||
font-size: 40rpx;
|
||||
}
|
||||
|
||||
.ui-navbar-box {
|
||||
background-color: transparent;
|
||||
width: 100%;
|
||||
|
@ -323,6 +335,7 @@ const init = () => {
|
|||
}
|
||||
|
||||
&.isFristPage {
|
||||
|
||||
.capsule-back,
|
||||
&::after {
|
||||
display: none;
|
||||
|
|
|
@ -2,21 +2,12 @@
|
|||
<view class="page-app" :class="['theme-' + sys.mode, 'main-' + sys.theme, 'font-' + sys.fontSize]">
|
||||
<view class="page-main" :style="[bgMain]">
|
||||
<!-- 顶部导航栏-情况1:默认通用顶部导航栏 -->
|
||||
<pb-navbar
|
||||
v-if="navbar === 'normal'"
|
||||
:title="title"
|
||||
:leftIcon="leftIcon"
|
||||
statusBar
|
||||
:color="color"
|
||||
:tools="tools"
|
||||
:opacityBgUi="opacityBgUi"
|
||||
@search="(e) => emits('search', e)"
|
||||
:defaultSearch="defaultSearch"
|
||||
/>
|
||||
<pb-navbar v-if="navbar === 'normal'" :title="title" :leftIcon="leftIcon" statusBar :color="color" :tools="tools"
|
||||
:opacityBgUi="opacityBgUi" @search="(e) => emits('search', e)" :defaultSearch="defaultSearch" />
|
||||
<view class="page-body" :style="[bgBody]">
|
||||
<!-- 顶部导航栏-情况2:沉浸式头部 -->
|
||||
<pb-inner-navbar v-if="navbar === 'inner'" :title="title" :leftIcon="leftIcon" />
|
||||
<view v-if="navbar === 'inner'" :style="[{ paddingTop: peach.$platform.navbar + 'px' }]"></view>
|
||||
<pb-inner-navbar v-if="navbar === 'inner'" :color="color" :title="title" :leftIcon="leftIcon" />
|
||||
<view v-if="navbar === 'inner'" :style="[{ paddingTop: peach.$platform.navBar + 'px' }]"></view>
|
||||
|
||||
<!-- 页面内容插槽 -->
|
||||
<slot />
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.9 KiB |
Loading…
Reference in New Issue