Files
kangyuan-mobile/pages/home/wallet.vue
T

167 lines
4.1 KiB
Vue

<template>
<s-pages title="钱包">
<!-- 头部 -->
<view class="header" :style="{ backgroundImage: 'url(' + $url + 'home/wallet2.png' + ')' }">
<view class="header-content">
<view class="title" @click="jumpPage('充值', '/pages/home/recharge')">
钱包余额 <uni-icons type="right" color="#fff" size="28rpx" />
</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 class="withdraw_btn" @click="jumpPage('变现', '/pages/home/liquidation')">去变现</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([]);
//获取钱包
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) {
uni.showModal({
// title: '',
content: '是否去' + typeTxt,
showCancel: true,
success: (res) => {
//用户点击确定
if (res.confirm) {
uni.navigateTo({
url: url,
});
}
},
});
}
</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;
.title {
font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
font-weight: 400;
font-size: 28rpx;
color: #ffffff;
line-height: 40rpx;
}
.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;
}
.withdraw_btn {
margin-left: auto;
height: 44rpx;
padding: 0 18rpx;
line-height: 44rpx;
font-size: 24rpx;
font-weight: 500;
color: #ffffff;
border: 2rpx solid rgba(255, 255, 255, 0.55);
border-radius: 22rpx;
background: rgba(255, 255, 255, 0.16);
box-sizing: border-box;
}
}
}
.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>