Files
kangyuan-mobile/pages/home/wallet.vue
T
2026-07-30 17:40:46 +08:00

218 lines
5.6 KiB
Vue

<template>
<s-pages title="钱包" :pink_bg="true">
<!-- 头部 -->
<view class="header" :style="{ backgroundImage: 'url(' + $url + 'home/wallet2.png' + ')' }" @click.stop>
<view class="header-content">
<view class="header-top">
<view class="title" @click="jumpPage('充值', '/pages/home/recharge')">
钱包余额 <uni-icons type="right" color="#fff" size="28rpx" />
</view>
<view class="more-trigger" @click.stop="toggleLiquidationMenu">
<uni-icons type="more-filled" color="#fff" size="34rpx" />
</view>
<view v-if="showLiquidationMenu" class="more-menu">
<view class="more-menu-item" @click.stop="goLiquidation">去变现</view>
<view class="more-menu-item" @click.stop="goWushuangLiquidation">无双变现</view>
</view>
</view>
<view class="num size68 m-y-8" @click="jumpPage('充值', '/pages/home/recharge')">
{{ $fen2yuan(money_obj?.balance || 0) }}
</view>
<view class="line" />
<view class="flex m-t-22 withdraw_row">
<view class="title"> 可提现金额 </view>
<view class="num m-l-34" @click="jumpPage('提现', '/pages/home/pay/withdraw')">
{{ $fen2yuan(money_obj?.withdrawAmount || 0) }}
</view>
</view>
</view>
</view>
<!-- 标题 -->
<view class="list-content">
<view class="title-left" />
<view class="title"> 好物推荐 </view>
<view class="title-right" />
</view>
<!-- 商品 -->
<su-sticky top="0">
<view class="goodsIndex">
<goods :list="tagList" v-if="tagList?.length"></goods>
</view>
</su-sticky>
</s-pages>
</template>
<script setup>
import { ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import * as api from '@/sheep/api/home/pay';
import * as apiIndex from '@/sheep/api/index/index';
import goods from '@/components/goods/goods.vue';
const money_obj = ref();
const tagList = ref([]);
const showLiquidationMenu = ref(false);
//获取钱包
function getData() {
api.getWallet().then((res) => {
if (res.code === 0) {
money_obj.value = res.data;
}
});
// 标签列表
apiIndex
.getproducttaglist({
categoryId: 1,
})
.then((res) => {
tagList.value = res.data || [];
});
}
onLoad(() => {
getData();
});
//充值提现弹框提示去跳转
function jumpPage(typeTxt, url) {
showLiquidationMenu.value = false;
uni.showModal({
// title: '',
content: '是否去' + typeTxt,
showCancel: true,
success: (res) => {
//用户点击确定
if (res.confirm) {
uni.navigateTo({
url: url,
});
}
},
});
}
function toggleLiquidationMenu() {
showLiquidationMenu.value = !showLiquidationMenu.value;
}
function goLiquidation() {
showLiquidationMenu.value = false;
jumpPage('变现', '/pages/home/liquidation?type=1&title=去变现');
}
function goWushuangLiquidation() {
showLiquidationMenu.value = false;
uni.navigateTo({
url: '/pages/home/liquidation?type=2&title=无双变现',
});
}
</script>
<style lang="scss" scoped>
.header {
height: 318rpx;
// background: linear-gradient(270deg, #75AFF6 0%, #366DEE 98.57%);
margin: 32rpx;
background-size: 100% 100%;
background-repeat: no-repeat;
overflow: hidden;
.header-content {
padding: 80rpx 32rpx 24rpx;
.header-top {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
}
.title {
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
font-weight: 400;
font-size: 28rpx;
color: #ffffff;
line-height: 40rpx;
}
.more-trigger {
width: 52rpx;
height: 52rpx;
border-radius: 26rpx;
background: rgba(255, 255, 255, 0.14);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.more-menu {
position: absolute;
top: 62rpx;
right: 0;
min-width: 176rpx;
padding: 10rpx;
border-radius: 18rpx;
background: rgba(26, 45, 88, 0.96);
box-shadow: 0 12rpx 30rpx rgba(0, 0, 0, 0.18);
z-index: 10;
}
.more-menu-item {
height: 68rpx;
padding: 0 24rpx;
border-radius: 14rpx;
color: #ffffff;
font-size: 26rpx;
display: flex;
align-items: center;
white-space: nowrap;
}
.num {
font-family: Avenir, Avenir;
font-weight: 900;
font-size: 32rpx;
color: #ffffff;
}
.line {
width: 394rpx;
height: 4rpx;
background: linear-gradient(
117deg,
rgba(255, 255, 255, 0.41) 0%,
rgba(255, 255, 255, 0) 100%
);
}
.withdraw_row {
align-items: center;
}
}
}
.list-content {
display: flex;
align-items: center;
justify-content: center;
.title {
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
font-weight: 500;
font-size: 32rpx;
color: #000;
margin: 0 16rpx;
}
.title-left {
width: 42rpx;
height: 6rpx;
background: linear-gradient(90deg, rgba(255, 255, 255, 0) 7.14%, #f25353 100%);
}
.title-right {
width: 42rpx;
height: 6rpx;
background: linear-gradient(-90deg, rgba(255, 255, 255, 0) 7.14%, #f25353 100%);
}
}
</style>