This commit is contained in:
2023-09-06 03:49:21 +08:00
parent 8b5de95140
commit b6ca53f70e
39 changed files with 2146 additions and 679 deletions

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "我的推广",
});

View File

@@ -0,0 +1,105 @@
<template>
<view>
<view class="card-list">
<view
class="item"
v-for="(item, index) in list"
:key="index"
@click="clickItem(item)"
>
<view class="text">
<IconFont :name="item.icon" color="red" size="30" />
<view>{{ item.label }}</view>
</view>
</view>
<view style="width: 45%;"></view>
</view>
<!-- 二维码弹窗 -->
<nut-popup :style="{ padding: '30px 50px' }" v-model:visible="show">
<view class="popup">
<view>推荐人二维码绑定</view>
<image :src="urlCode" />
</view>
</nut-popup>
</view>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { IconFont } from "@nutui/icons-vue-taro";
import Taro from "@tarojs/taro";
const show = ref(false);
const urlCode = ref("");
const list = ref([
{
id: 1,
icon: "scan",
label: "推广名片",
},
{
id: 2,
icon: "date",
label: "积分明细",
},
{
id: 3,
icon: "my2",
label: "推广用户",
},
]);
const clickItem = (item: any) => {
if (item.id === 1) {
urlCode.value = `https://api.pwmqr.com/qrcode/create?url=${Taro.getStorageSync(
"token"
)}`;
show.value = true;
} else if (item.id === 2) {
Taro.navigateTo({
url: "/pages/users/distribution/integral/index",
});
} else {
Taro.navigateTo({
url: "/pages/users/distribution/userlist/index",
});
}
};
</script>
<style lang="scss">
.card-list {
display: flex;
justify-content: space-evenly;
flex-wrap: wrap;
.item {
width: 45%;
height: 200px;
background-color: #fff;
border-radius: 20px;
margin-top: 10px;
text-align: center;
padding: 10px;
position: relative;
.text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
}
.popup {
text-align: center;
image {
width: 300px;
height: 300px;
}
}
</style>

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "积分明细",
});

View File

@@ -0,0 +1,85 @@
<template>
<view>
<view v-if="data.length > 0">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="left">
<view>昵称{{ item.nick_name }}</view>
<view>购买商品{{ item.goods_name }}</view>
<view>支付时间{{ item.add_time.slice(0, 10) }}</view>
</view>
<view class="right">
<view style="color: red"
>+<text>{{ item.number }}积分</text></view
>
</view>
</view>
<nut-pagination
v-model="page.PageNum"
:total-items="page.ItemCount"
:items-per-page="page.PageSize"
@change="pageChange"
/>
</view>
<view v-else>
<nut-empty description="暂无积分明细" />
</view>
</view>
</template>
<script setup lang="ts">
import { useLoad, showToast } from "@tarojs/taro";
import { ref } from "vue";
import { getTGIntegralDetail } from "../../../../api/user";
const data = ref([]);
useLoad(() => {
getData();
});
const page = ref({
PageNum: 1,
PageSize: 10,
ItemCount: 0,
});
const pageChange = (e: number) => {
page.value.PageNum = e;
getData();
};
const getData = async () => {
try {
const res = await getTGIntegralDetail({
PageNum: page.value.PageNum,
PageSize: page.value.PageSize,
});
data.value = res.data.data || [];
page.value.ItemCount = res.data.count;
} catch (error) {
showToast({ title: error.msg, icon: "none" });
}
};
</script>
<style lang="scss">
.card-list {
margin: 10px 20px;
background-color: #fff;
display: flex;
border-radius: 10px;
padding: 20px;
justify-content: space-between;
align-items: center;
}
.nut-pagination {
position: absolute;
margin-top: 10px;
left: 50%;
transform: translateX(-50%);
}
</style>

View File

@@ -0,0 +1,3 @@
export default definePageConfig({
navigationBarTitleText: "推广人统计",
});

View File

@@ -0,0 +1,93 @@
<template>
<view>
<view v-if="data.length > 0">
<view
class="card-list"
v-for="(item, index) in (data as any[])"
:key="index"
>
<view class="left">
<image :src="item.avatarUrl" />
<view class="text">
<view>{{ item.nickName }}</view>
<view>{{ item.phone }}</view>
</view>
</view>
<view class="right"></view>
</view>
<nut-pagination
v-model="page.PageNum"
:total-items="page.ItemCount"
:items-per-page="page.PageSize"
@change="pageChange"
/>
</view>
<view v-else>
<nut-empty description="暂无明细"></nut-empty>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from "vue";
import { useLoad, showToast } from "@tarojs/taro";
import { getTGUserList } from "../../../../api/user";
useLoad(() => {
getData();
});
const data = ref([]);
const page = ref({ PageNum: 1, PageSize: 10, ItemCount: 0 });
const pageChange = (e: number) => {
page.value.PageNum = e;
getData();
};
const getData = async () => {
try {
const res = await getTGUserList({
PageNum: page.value.PageNum,
PageSize: page.value.PageSize,
});
data.value = res.data.data || [];
page.value.ItemCount = res.data.count;
} catch (error) {
showToast({ title: error.msg, icon: "none" });
}
};
</script>
<style lang="scss">
.nut-pagination {
position: absolute;
margin-top: 10px;
left: 50%;
transform: translateX(-50%);
}
.card-list {
width: 700px;
background-color: #fff;
margin: 10px auto;
border-radius: 10px;
padding: 20px;
.left {
display: flex;
align-items: center;
image {
width: 100px;
height: 100px;
border-radius: 50%;
}
.text {
margin-left: 20px;
}
}
}
</style>