Files
kangyuan-mobile/pages/increment/user.vue
T
2026-05-26 15:52:30 +08:00

194 lines
5.3 KiB
Vue

<template>
<s-pages title="我的" leftUrl="/pages/index/index" :goLeft="false">
<view class="p-x-32 w100 h_364 relative m-t-42 color0">
<view class="p-x-32 w100 h100 absolute t0 l0">
<image class="w100 h100" src="/static/increment/bg.png" mode="scaleToFill" />
</view>
<view class="w100 h100 relative p-x-32 p-t-30 p-b-4">
<view class="flex-center ju-between m-b-62">
<view class="w_150 h_150 absolute t-42 l20 img">
<image
class="w100 h100"
v-if="dataObj.avatar"
:src="dataObj.avatar"
mode="scaleToFill"
/>
<image class="w100 h100" v-else src="/static/head_null.png" mode="scaleToFill" />
</view>
<view class="lineOne m-l-164">{{ dataObj.nickname }}</view>
<view>
<span class="size28">自动拼团</span>
<switch
:checked="dataObj.automaticGroupBuy ? true : false"
@change="autoChange"
color="#F7492E"
style="transform: scale(0.7)"
/>
</view>
</view>
<view class="flex-row wrap" v-if="arr && arr.length">
<view class="m-b-24" style="width: 50%" v-for="(v, i) in arr" :key="i">
<view class="color4A size24 flex-center ju-flex-start" @click="go(v.path)">
<span>{{ v.name }}</span>
<uni-icons v-if="v.path" type="right" color="#4A4A4A" size="12" />
</view>
<view class="size32">{{ dataObj[v.num] || 0 }}</view>
</view>
</view>
</view>
</view>
<view class="box m-x-32 m-t-52 bg24" v-if="mesArr.length">
<view class="relative h_60 w100">
<view class="absolute h_60 w100">
<image class="w100 h100" src="/static/increment/1.png" mode="scaleToFill" />
</view>
<view class="relative line60 w100 p-r-28" style="text-align: right; color: #fff">
已参团
</view>
</view>
<view class="card4">
<maoScroll
:data="mesArr"
:lineHeight="72"
:animation="1000"
:animationScroll="1000"
:showNum="3"
>
<template #default="{ line }">
<view class="radius8 p-x-16 flex-center ju-flex-start h100" style="display: line-block">
<view class="m-r-18 userImg flex-center">
<image
class="w_56 h_56"
:src="line?.avatar"
mode="scaleToFill"
v-if="line?.avatar"
style="border-radius: 50%"
/>
<image
v-else
class="w_56 h_56"
:src="`${$url}home/head.png`"
mode="scaleToFill"
style="border-radius: 50%"
/>
</view>
<view class="size28 c0 line54 lineOne">{{ line?.nickname }}已参团</view>
</view>
</template>
</maoScroll>
</view>
</view>
<card_tabBar :index="3"></card_tabBar>
</s-pages>
</template>
<script setup>
import { ref, reactive, getCurrentInstance, onMounted } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import card_tabBar from './components/increment/card_tabBar.vue';
import maoScroll from '@/components/mao-scroll/mao-scroll.vue';
import * as api from '@/sheep/api/increment';
const { proxy } = getCurrentInstance();
let currentBalance = ref();
let dataObj = ref({});
let arr = ref([
{
name: '积分账户',
num: 'currentBalance',
path: '/pages/increment/detail?type=1',
},
{
name: '增量账户',
num: 'incrementPoint',
path: '/pages/increment/detail?type=2',
},
{
name: '拼团数',
num: 'totalGroupBuyCount',
},
{
name: '今日拼团',
num: 'todayGroupBuyCount',
},
]);
let mesArr = ref([]);
const autoChange = (e) => {
// 0关闭自动拼团1自动拼团
console.log(e.detail.value);
let b = e.detail.value ? 1 : 0;
api
.automaticGroupBuy({
automaticGroupBuy: b,
})
.then((res) => {
if (res.code === 0) {
uni.showToast({
title: '设置成功',
});
getData();
}
});
// api.automaticGroupBuy
};
const go = (path) => {
if (!path) return;
uni.navigateTo({
url: path,
});
};
const getData = () => {
api.getUserGroupInfo({}).then((res) => {
if (res.code === 0) {
dataObj.value = res.data;
api
.exAndBesPointList({
pageNo: 1,
pageSize: 10,
})
.then((res) => {
if (res.code === 0) {
dataObj.value.currentBalance = res.data.currentBalance;
}
});
}
});
};
const getList = () => {
api
.getParticipants({
pageNo: 1,
pageSize: 20,
})
.then((res) => {
if (res.code === 0) {
mesArr.value = res.data.list;
}
});
};
onMounted(() => {
getData();
getList();
});
</script>
<style scoped lang="scss">
.box {
border-radius: 30rpx 30rpx 0 0;
overflow: hidden;
}
.color0 {
color: #000000;
}
.color4A {
color: #4a4a4a;
}
.img {
border-radius: 50%;
overflow: hidden;
}
</style>