Merge branch 'master' of https://gitea.zianxin.com/zax/Friendship-and-chat-uniapp
This commit is contained in:
commit
408327bffd
2 files changed
+118
-27
No files matched your search
+110
-27
@@ -29,9 +29,9 @@
|
||||
<!-- 提现相关 -->
|
||||
<view class="mx-20rpx mt-30rpx bg-color-dark rounded-12rpx px-6 py-4">
|
||||
<view class="flex items-center justify-center">
|
||||
<view class="flex-1 flex-col justify-center items-center" v-for="(v, i) in data.txTab" :key="i"
|
||||
<view class="flex-1 flex-col justify-center items-center" v-for="(v, i) in state.txTab" :key="i"
|
||||
@tap="doTxItem(v)">
|
||||
<text class="text-color-theme text-2xl">{{ v.value }}</text>
|
||||
<text class="text-color-theme text-2xl"> {{ v.value }}</text>
|
||||
<text class="mt-10rpx">{{ v.title }}</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -57,7 +57,7 @@
|
||||
<view class="mx-20rpx mt-30rpx bg-color-dark rounded-12rpx px-6 py-4">
|
||||
<view class="text-lg">邀请奖励规则</view>
|
||||
<view class="mt-30rpx">
|
||||
<view class="card-thin flex items-start px-16rpx py-12rpx mb-15rpx" v-for="(v, i) in data.rule">
|
||||
<view class="card-thin flex items-start px-16rpx py-12rpx mb-15rpx" v-for="(v, i) in state.rule">
|
||||
<view class="size-40rpx flex justify-center items-center bg-color-theme-dark rounded-8rpx">
|
||||
<text class="text-base">{{ i + 1 }}</text>
|
||||
</view>
|
||||
@@ -68,7 +68,7 @@
|
||||
<!-- 海报 -->
|
||||
<view class="mx-20rpx mt-30rpx bg-color-dark rounded-12rpx px-6 py-4">
|
||||
<view class="text-lg">我的邀请海报</view>
|
||||
<image class="mt-30rpx" src="/src/static/upload-icon.png" mode="widthFix" />
|
||||
<image class="mt-30rpx" :src="state.posterPic" mode="widthFix" />
|
||||
<view class="mt-30rpx flex justify-between items-center text-xs">
|
||||
<view
|
||||
class="flex-1 text-center px-2 py-8rpx border-1px border-solid rounded-full border-color-theme active_cl_bg-color-theme">
|
||||
@@ -76,7 +76,8 @@
|
||||
</view>
|
||||
<view class="w-30rpx" />
|
||||
<view
|
||||
class="flex-1 text-center px-2 py-8rpx border-1px border-solid rounded-full border-color-theme-dark bg-color-theme-dark active_cl_bg-color-theme">
|
||||
class="flex-1 text-center px-2 py-8rpx border-1px border-solid rounded-full border-color-theme-dark bg-color-theme-dark active_cl_bg-color-theme"
|
||||
@tap="savePoster">
|
||||
保存海报
|
||||
</view>
|
||||
</view>
|
||||
@@ -87,31 +88,17 @@
|
||||
|
||||
<script setup>
|
||||
import { computed, reactive, ref } from 'vue';
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
|
||||
import sheep from '@/sheep';
|
||||
import RecentApi from '@/sheep/api/member/recent';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { fen2yuan } from '@/sheep/hooks/useGoods';
|
||||
import BrokerageApi from '@/sheep/api/trade/brokerage';
|
||||
import TradeConfigApi from '@/sheep/api/trade/config.js'
|
||||
import SocialApi from "@/sheep/api/member/social"
|
||||
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
|
||||
const data = {
|
||||
txTab: [
|
||||
{
|
||||
title: '累计收益',
|
||||
value: '100',
|
||||
path: "/pages/wechat/pages/gift/history",
|
||||
},
|
||||
{
|
||||
title: '可提现',
|
||||
value: '200',
|
||||
path: "/pages/wechat/pages/gift/index",
|
||||
},
|
||||
{
|
||||
title: '成功邀请',
|
||||
value: '300',
|
||||
path: "/pages/wechat/pages/inviter/index",
|
||||
},
|
||||
],
|
||||
menuTab: [
|
||||
{
|
||||
title: '礼物奖励',
|
||||
@@ -138,14 +125,110 @@ const data = {
|
||||
path: "",
|
||||
},
|
||||
],
|
||||
rule: [
|
||||
}
|
||||
|
||||
const state = reactive({
|
||||
txTab: [
|
||||
{
|
||||
title: '通过链接/二维码邀请用户首次充值,可获得50%现金奖励',
|
||||
title: '累计收益',
|
||||
value: '100',
|
||||
path: "/pages/wechat/pages/gift/history",
|
||||
},
|
||||
{
|
||||
title: '邀请奖励满200元可提现,3个月工作日内到账',
|
||||
title: '可提现',
|
||||
value: '200',
|
||||
path: "/pages/wechat/pages/gift/index",
|
||||
},
|
||||
{
|
||||
title: '成功邀请',
|
||||
value: '300',
|
||||
path: "/pages/wechat/pages/inviter/index",
|
||||
},
|
||||
],
|
||||
rule: [
|
||||
{
|
||||
title: '通过链接/二维码邀请用户首次充值,可获得**%现金奖励',
|
||||
},
|
||||
{
|
||||
title: '邀请奖励满***元可提现,3个月工作日内到账',
|
||||
},
|
||||
],
|
||||
summary: {},
|
||||
posterPic: "",
|
||||
});
|
||||
|
||||
|
||||
onShow(async () => {
|
||||
await getTradeConfig()
|
||||
await getBrokerageUserSummary()
|
||||
getMiniProgramPoster()
|
||||
})
|
||||
|
||||
// 获取分销配置
|
||||
const getTradeConfig = async () => {
|
||||
try {
|
||||
let { code, data } = await TradeConfigApi.getTradeConfig();
|
||||
if (code != 0) {
|
||||
throw new Error()
|
||||
}
|
||||
if (data.brokerageWithdrawMinPrice !== undefined) {
|
||||
state.rule[1].title = `邀请奖励满${fen2yuan(data.brokerageWithdrawMinPrice)}元可提现,3个月工作日内到账`
|
||||
}
|
||||
if (data.brokerageFirstPercent !== undefined) {
|
||||
state.rule[0].title = `通过链接/二维码邀请用户首次充值,可获得${data.brokerageFirstPercent || 50}%现金奖励`
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("|获取分销配置|,意外的错误:", error);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取收益统计
|
||||
const getBrokerageUserSummary = async () => {
|
||||
let { code, data } = await BrokerageApi.getBrokerageUserSummary();
|
||||
if (code === 0) {
|
||||
state.summary = data || {}
|
||||
// 累计收益
|
||||
if (state.summary.withdrawPrice !== undefined) {
|
||||
state.txTab[0].value = fen2yuan(state.summary.withdrawPrice)
|
||||
}
|
||||
// 可提现
|
||||
if (state.summary.brokeragePrice !== undefined) {
|
||||
state.txTab[1].value = fen2yuan(state.summary.brokeragePrice)
|
||||
}
|
||||
// 成功邀请用户
|
||||
const firstBrokerageUserCount = state.summary.firstBrokerageUserCount ?? 0;
|
||||
const secondBrokerageUserCount = state.summary.secondBrokerageUserCount ?? 0;
|
||||
state.txTab[2].value = firstBrokerageUserCount + secondBrokerageUserCount
|
||||
}
|
||||
}
|
||||
|
||||
// 获取分销海报
|
||||
const getMiniProgramPoster = async () => {
|
||||
try {
|
||||
let { code, data } = await BrokerageApi.getBrokerageCode();
|
||||
if (code != 0) throw new Error()
|
||||
state.posterPic = data?.posterPic || ''
|
||||
} catch (error) {
|
||||
console.error("|获取分销海报|,意外的错误:", error);
|
||||
}
|
||||
}
|
||||
|
||||
// 保存海报
|
||||
const savePoster = () => {
|
||||
if (!state.posterPic) {
|
||||
uni.showToast({ title: '海报不存在', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
uni.saveImageToPhotosAlbum({
|
||||
filePath: state.posterPic,
|
||||
success: () => {
|
||||
uni.showToast({ title: '保存成功', icon: 'success' });
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.showToast({ title: '保存失败', icon: 'none' });
|
||||
console.error("|保存海报|,意外的错误:", err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const doTxItem = (item) => {
|
||||
|
||||
@@ -106,6 +106,14 @@ const BrokerageApi = {
|
||||
params,
|
||||
});
|
||||
},
|
||||
// 获取分销码和分销海报
|
||||
getBrokerageCode: (params) => {
|
||||
return request({
|
||||
url: '/trade/brokerage-code/get',
|
||||
method: 'GET',
|
||||
params,
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default BrokerageApi;
|
||||
Reference in new issue
Block a user