|
|
@@ -4,41 +4,60 @@
|
|
|
<CommonTopBanner
|
|
|
title="升级成为管理员"
|
|
|
showNav
|
|
|
+ :customBack="true"
|
|
|
+ @backPressed="handleBack"
|
|
|
>
|
|
|
<FlexCol gap="gap.lg" padding="padding.md">
|
|
|
|
|
|
- <!-- <FlexRow justify="flex-end">
|
|
|
- <Button icon="https://xy.wenlvti.net/app_static/images/home/IconOrder.png" text="我的订单" @click="handleMyOrders()" />
|
|
|
- </FlexRow>
|
|
|
- <FlexRow center>
|
|
|
- <Image src="https://xy.wenlvti.net/app_static/images/village/IconBlessing.png" :width="100" :height="100" />
|
|
|
- </FlexRow> -->
|
|
|
-
|
|
|
- <FlexCol padding="padding.md" center>
|
|
|
- <Text
|
|
|
- text="感谢您选择升级管理员,您可以为村社做出管理贡献,请选择您要付款方式"
|
|
|
- fontConfig="contentText" :fontSize="30" textAlign="center"
|
|
|
- />
|
|
|
- </FlexCol>
|
|
|
-
|
|
|
- <BuyFruitInfo @pay="handleDirectPay(1, 3)">
|
|
|
- <template #prepend>
|
|
|
- <BoxMid direction="row" justify="space-between" align="center" gap="gap.md">
|
|
|
- <FlexCol width="74%">
|
|
|
- <Text text="在线支付" fontConfig="lightImportantTitle" :fontSize="42" />
|
|
|
- <Text text="推荐使用微信线支付方式,方便快捷,立即生效" fontConfig="lightGoldTitle" :fontSize="30" />
|
|
|
- </FlexCol>
|
|
|
- <FrameButton primary text="选择" @click="handleDirectPay(1, 1)" />
|
|
|
- </BoxMid>
|
|
|
- <BoxMid direction="row" justify="space-between" align="center" gap="gap.md">
|
|
|
- <FlexCol width="74%">
|
|
|
- <Text text="测试" fontConfig="lightImportantTitle" :fontSize="42" />
|
|
|
- <Text text="¥ 0.01" fontConfig="lightGoldTitle" :fontSize="30" />
|
|
|
- </FlexCol>
|
|
|
- <FrameButton primary text="选择" @click="handleDirectPay(2, 1)" />
|
|
|
- </BoxMid>
|
|
|
- </template>
|
|
|
- </BuyFruitInfo>
|
|
|
+ <template v-if="step === 'choose'">
|
|
|
+ <FlexCol padding="padding.md" center>
|
|
|
+ <Text
|
|
|
+ text="欢迎升级村社管理员,您可以为村社做出管理贡献,请选择升级时长"
|
|
|
+ fontConfig="contentText" :fontSize="30" textAlign="center"
|
|
|
+ />
|
|
|
+ </FlexCol>
|
|
|
+
|
|
|
+ <BoxMid
|
|
|
+ v-for="item in loader.content.value" :key="item.id"
|
|
|
+ direction="row" justify="space-between" align="center" gap="gap.md"
|
|
|
+ >
|
|
|
+ <FlexCol width="74%" gap="gap.md">
|
|
|
+ <FlexRow align="center" gap="gap.md">
|
|
|
+ <Text :text="item.name" fontConfig="lightImportantTitle" :fontSize="42" />
|
|
|
+ <Text :text="`(${item.timeTypeText})`" :fontSize="42" :color="item.timeTypeText === '永久' ? 'warning' : 'success'" />
|
|
|
+ </FlexRow>
|
|
|
+ <FlexRow align="center" gap="gap.md">
|
|
|
+ <Tag v-if="item.pointsLimit > 0" :text="`最低积分要求:${item.pointsLimit}`" :type="isPointEnough(item.pointsLimit) ? 'success' : 'danger'" />
|
|
|
+ </FlexRow>
|
|
|
+ </FlexCol>
|
|
|
+ <FlexRow align="center" gap="gap.lg">
|
|
|
+ <Text :text="`¥${item.price}`" fontConfig="lightGoldTitle" :fontSize="40" />
|
|
|
+ <FrameButton primary text="选择" @click="handleChoose(item)" />
|
|
|
+ </FlexRow>
|
|
|
+ </BoxMid>
|
|
|
+
|
|
|
+ </template>
|
|
|
+ <template v-else-if="step === 'pay'">
|
|
|
+
|
|
|
+ <FlexCol padding="padding.md" center>
|
|
|
+ <Text
|
|
|
+ text="感谢您选择升级管理员,您可以为村社做出管理贡献,请选择您要付款方式"
|
|
|
+ fontConfig="contentText" :fontSize="30" textAlign="center"
|
|
|
+ />
|
|
|
+ </FlexCol>
|
|
|
+
|
|
|
+ <BuyFruitInfo :price="choosedLevel?.price || 0" @pay="handleDirectPay(3)">
|
|
|
+ <template #prepend>
|
|
|
+ <BoxMid direction="row" justify="space-between" align="center" gap="gap.md">
|
|
|
+ <FlexCol width="74%">
|
|
|
+ <Text text="在线支付" fontConfig="lightImportantTitle" :fontSize="42" />
|
|
|
+ <Text text="推荐使用微信线支付方式,方便快捷,立即生效" fontConfig="lightGoldTitle" :fontSize="30" />
|
|
|
+ </FlexCol>
|
|
|
+ <FrameButton primary text="选择" @click="handleDirectPay(1)" />
|
|
|
+ </BoxMid>
|
|
|
+ </template>
|
|
|
+ </BuyFruitInfo>
|
|
|
+ </template>
|
|
|
</FlexCol>
|
|
|
|
|
|
<UpgradeManagementSuccessDialog
|
|
|
@@ -51,23 +70,26 @@
|
|
|
<script setup lang="ts">
|
|
|
import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
|
|
|
import { useRequireLogin } from '@/common/composeabe/RequireLogin';
|
|
|
+import { useVolunteerInfo } from '../composeabe/VolunteerInfo';
|
|
|
+import { useSimpleDataLoader } from '@/components/composeabe/loader/SimpleDataLoader';
|
|
|
import { ref } from 'vue';
|
|
|
-import { navTo, backAndCallOnPageBack } from '@/components/utils/PageAction';
|
|
|
+import { back, backAndCallOnPageBack } from '@/components/utils/PageAction';
|
|
|
import { showError } from '@/common/composeabe/ErrorDisplay';
|
|
|
import BoxMid from '@/common/components/box/BoxMid.vue';
|
|
|
import CommonTopBanner from '@/common/components/CommonTopBanner.vue';
|
|
|
import FrameButton from '@/common/components/FrameButton.vue';
|
|
|
import Text from '@/components/basic/Text.vue';
|
|
|
import FlexCol from '@/components/layout/FlexCol.vue';
|
|
|
-import OfficialApi from '@/api/light/OfficialApi';
|
|
|
+import OfficialApi, { type StaffLevelItem } from '@/api/light/OfficialApi';
|
|
|
import UpgradeManagementSuccessDialog from './dialogs/UpgradeManagementSuccess.vue';
|
|
|
-import FlexRow from '@/components/layout/FlexRow.vue';
|
|
|
-import Icon from '@/components/basic/Icon.vue';
|
|
|
import BuyFruitInfo from './components/BuyFruitInfo.vue';
|
|
|
+import FlexRow from '@/components/layout/FlexRow.vue';
|
|
|
+import Tag from '@/components/display/Tag.vue';
|
|
|
|
|
|
const upgradeManagementSuccessDialog = ref<InstanceType<typeof UpgradeManagementSuccessDialog>>();
|
|
|
|
|
|
const { requireLoginAsync } = useRequireLogin();
|
|
|
+const { volunteerInfo } = useVolunteerInfo();
|
|
|
|
|
|
function handlePaySuccess() {
|
|
|
setTimeout(() => {
|
|
|
@@ -81,22 +103,44 @@ const { querys } = useLoadQuerys({
|
|
|
|
|
|
});
|
|
|
|
|
|
-async function handleMyOrders() {
|
|
|
- if (!await requireLoginAsync('登录后查看我的升级订单哦'))
|
|
|
- return;
|
|
|
- navTo('/pages/home/village/upgrade/my-orders', {
|
|
|
- villageId: querys.value.villageId,
|
|
|
- });
|
|
|
+const step = ref<'choose' | 'pay'>('choose');
|
|
|
+const choosedLevel = ref<StaffLevelItem|null>(null);
|
|
|
+const loader = useSimpleDataLoader(async () => {
|
|
|
+ return (await OfficialApi.getStaffList(1, 10)).list;
|
|
|
+});
|
|
|
+
|
|
|
+function isPointEnough(pointLimit: number) {
|
|
|
+ return (volunteerInfo.value?.points || 0) >= pointLimit;
|
|
|
}
|
|
|
|
|
|
-async function handleDirectPay(levelType: number, payType: 1 | 3) {
|
|
|
+function handleBack() {
|
|
|
+ if (step.value === 'pay')
|
|
|
+ step.value = 'choose';
|
|
|
+ else
|
|
|
+ back();
|
|
|
+}
|
|
|
+function handleChoose(level: StaffLevelItem) {
|
|
|
+ console.log(level,volunteerInfo.value );
|
|
|
+ if (level.pointsLimit > 0 && !isPointEnough(level.pointsLimit)) {
|
|
|
+ showError(
|
|
|
+ '您的积分不足,现有 ' + (volunteerInfo.value?.points || 0) +
|
|
|
+ ' 积分,无法升级。您可以先为村社做贡献(做任务、采编内容等)获取积分哦!');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ step.value = 'pay';
|
|
|
+ choosedLevel.value = level;
|
|
|
+}
|
|
|
+async function handleDirectPay(payType: 1 | 3) {
|
|
|
if (!requireLoginAsync('登录后为村社升级,做出你的贡献哦'))
|
|
|
return;
|
|
|
+ if (!choosedLevel.value)
|
|
|
+ throw new Error('请选择升级等级');
|
|
|
try {
|
|
|
uni.showLoading({ title: '创建订单中...' });
|
|
|
const { order: orderInfo, pay: payInfo } = await OfficialApi.upgradeStaff(
|
|
|
querys.value.villageId,
|
|
|
- levelType,
|
|
|
+ choosedLevel.value.id,
|
|
|
payType,
|
|
|
);
|
|
|
if (payType === 1) {
|