From ffb887f3bfe668f6f96b7e8ed97c9a320204c853 Mon Sep 17 00:00:00 2001 From: anonymous Date: Thu, 9 Jan 2025 15:47:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=B9=E6=8E=A5=E5=AE=8C=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useCaptcha.ts | 12 +- src/pages-sub/asset/index.vue | 52 +++-- src/pages-sub/convert/index.vue | 18 +- src/pages-sub/invite/index.vue | 2 +- src/pages-sub/withdrawal-detail/index.vue | 95 ++++----- src/pages-sub/withdrawal/index.vue | 31 +-- src/pages/index/index.vue | 51 +++-- src/pages/invest/index.vue | 230 ++++++++++++++-------- src/pages/invite/index.vue | 116 ++++++----- src/pages/login/index.vue | 6 +- src/pages/my/index.vue | 18 +- src/service/index.ts | 40 +++- 12 files changed, 416 insertions(+), 255 deletions(-) diff --git a/src/hooks/useCaptcha.ts b/src/hooks/useCaptcha.ts index bde4915..1a60e2d 100644 --- a/src/hooks/useCaptcha.ts +++ b/src/hooks/useCaptcha.ts @@ -1,11 +1,15 @@ +const baseUrl = import.meta.env.VITE_SERVER_BASEURL export const useCaptcha = () => { - const codeUrl = ref('') + const t = ref(Date.now()) + + const codeUrl = computed(() => { + return baseUrl + '/captcha.html?t=' + t.value + }) const refreshCode = () => { - const baseUrl = import.meta.env.VITE_SERVER_BASEURL - codeUrl.value = baseUrl + '/captcha.html?t=' + Date.now() + t.value = Date.now() } onMounted(() => { refreshCode() }) - return { codeUrl, refreshCode } + return { codeUrl, t, refreshCode } } diff --git a/src/pages-sub/asset/index.vue b/src/pages-sub/asset/index.vue index 2c2d054..69f6d33 100644 --- a/src/pages-sub/asset/index.vue +++ b/src/pages-sub/asset/index.vue @@ -13,30 +13,40 @@ import { useUserStore } from '@/store' const userStore = useUserStore() -const tabList = [ - { label: '我的余额', value: 0 }, - { label: '救济金余额', value: 1 }, - { label: '养老金余额', value: 2 }, - { label: '佣金余额', value: 3 }, -] +const tabList = computed(() => { + return [ + { label: '我的余额', value: 1, money: userStore.userInfo.money }, + { label: '救济金余额', value: 2, money: userStore.userInfo.moneyjiu }, + { label: '养老金余额', value: 3, money: userStore.userInfo.moneyold }, + { label: '团队佣金余额', value: 4, money: userStore.userInfo.moneyyong }, + ] +}) const tabIndex = ref(0) -const detailInfo = ref({ - point: 1, - score: 1000, - suminvest: '10000', -}) -const { list: assetList } = useListPageRequest((params) => - getMyAssetAPI(params).then((res) => { - detailInfo.value = res.data - res.data.data = res.data.list - return res.data - }), +const { list: assetList, onReload } = useListPageRequest( + (params) => + getMyAssetAPI(params).then((res) => { + return res + }), + { + autoRequest: false, + }, ) onLoad((options) => { tabIndex.value = Number(options.tabIndex ?? 0) }) +watch( + () => tabIndex.value, + (index) => { + onReload({ + type: unref(tabList)[index].value, + }) + }, + { + immediate: true, + }, +) @@ -107,28 +148,37 @@ import WechatIcon from '@/static/images/invest/wechat-icon.png' import UnionpayIcon from '@/static/images/invest/unionpay-icon.png' import { getInvestmentListAPI, submitInvestAPI } from '@/service' import { useUserStore } from '@/store' -import { mergeStep, showModal } from '@/utils' +import { getImageUrl, mergeStep, showModal } from '@/utils' defineOptions({ name: 'Home', }) -const showPayType = ref(false) -const panels = ref([ - { - iconUrl: WechatIcon, - title: '微信支付', - }, - { - iconUrl: AlipayIcon, - title: '支付宝支付', - }, - { - iconUrl: UnionpayIcon, - title: '银联支付', - }, -]) -const { list: investmentList } = useListPageRequest(getInvestmentListAPI) +const tabList = [ + { + value: 1, + title: '养老', + }, + { + value: 2, + title: '医疗', + }, +] +const tabValue = ref(1) + +const { list: investmentList, onReload } = useListPageRequest((params) => + getInvestmentListAPI({ + ...params, + type: tabValue.value, + }), +) + +watch( + () => tabValue.value, + () => { + onReload() + }, +) const userStore = useUserStore() @@ -138,9 +188,23 @@ const onGoInvestDetail = () => { }) } -const onSelectPayType = ({ item, index }: any) => { - console.log(item, index) - alert(item.title) +const showRightConfig = ref({ + show: false, + data: null, +}) +watch( + () => showRightConfig.value.show, + (val) => { + if (!val) { + showRightConfig.value.data = null + } + }, +) +const onShowRights = (item: any) => { + showRightConfig.value = { + show: true, + data: item, + } } const onInvest = mergeStep(async (item: any) => { diff --git a/src/pages/invite/index.vue b/src/pages/invite/index.vue index 37fac74..788336d 100644 --- a/src/pages/invite/index.vue +++ b/src/pages/invite/index.vue @@ -13,7 +13,12 @@ import NavBar from '@/components/NavBar.vue' import VueQrcode from '@chenfengyuan/vue-qrcode' import { useUserStore } from '@/store' import Avatar from '@/components/Avatar.vue' -import { getCommunityMyInviteAPI } from '@/service' +import { + getCommunityInviteFirstAPI, + getCommunityInviteRewardAPI, + getCommunityMyInviteAPI, +} from '@/service' +import { showModal } from '@/utils' const userStore = useUserStore() @@ -37,6 +42,61 @@ const { list } = useListPageRequest((params) => { return res.data }) }) + +const inviteInfo = ref(null) +const loadInviteInfo = async () => { + const { data } = await getCommunityInviteFirstAPI() + inviteInfo.value = data + // inviteInfo.value = { + // num: 10, + // isuserauth: 1, + // realrewards: '200', + // jianglitiaojian: { + // '10': '3000', + // '20': '5000', + // '30': '15000', + // '40': '30000', + // '50': '50000', + // }, + // open: 1, + // } +} + +onShow(async () => { + await loadInviteInfo() +}) +const taskList = computed(() => { + if (!inviteInfo.value) return [] + + const inviteTask = Object.keys(inviteInfo.value.jianglitiaojian) + const inviteTaskList = inviteTask.map((key) => ({ + title: `邀请${key}人(${inviteInfo.value.num}/${key})`, + desc: `每月额外领取${inviteInfo.value.jianglitiaojian[key]}元数济金`, + level: key, + status: Number(inviteInfo.value.num) >= Number(key), + open: false, + })) + // 查找最后一个完成的任务,并设置open为true + const lastCompletedTask = inviteTaskList.findLast((item) => item.status) + if (lastCompletedTask) { + lastCompletedTask.open = inviteInfo.value.open + } + return [ + { + title: '注册实名', + desc: `领取${inviteInfo.value.realrewards}元救济金`, + status: inviteInfo.value.isuserauth, + open: false, + }, + ...inviteTaskList, + ] +}) + +async function onGetReward(level) { + await getCommunityInviteRewardAPI({ level }) + showModal('领取成功') + await loadInviteInfo() +}