| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <template>
- <CommonTopBanner
- title="升级村社"
- showNav
- >
- <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>
- <FlexCol gap="gap.md">
- <BoxMid direction="row" justify="space-between" align="center" gap="gap.md">
- <FlexCol width="74%">
- <FlexRow align="center" gap="gap.md">
- <Icon icon="wechat" size="36" />
- <Text text="在线支付" fontConfig="lightImportantTitle" :fontSize="42" />
- </FlexRow>
- <Text text="推荐使用微信线支付方式,方便快捷,立即生效" fontConfig="lightGoldTitle" :fontSize="30" />
- </FlexCol>
- <FrameButton primary text="选择" @click="handleDirectPay(1)" />
- </BoxMid>
- <BoxMid direction="row" justify="space-between" align="center" gap="gap.md">
- <FlexCol width="74%">
- <FlexRow align="center" gap="gap.md">
- <Icon icon="https://xy.wenlvti.net/app_static/images/village/IconFruit.png" size="40" />
- <Text text="乡源果支付" fontConfig="lightImportantTitle" :fontSize="42" />
- </FlexRow>
- <Text :text="`余额 ${0} 乡源果`" fontConfig="lightGoldTitle" :fontSize="30" />
- </FlexCol>
- <FrameButton primary text="选择" @click="handleDirectPay(3)" />
- </BoxMid>
- <BoxMid
- v-if="false"
- 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="handlePublicPay" />
- </BoxMid>
- </FlexCol>
- </FlexCol>
- <DirectPayDialog
- ref="directPayDialog"
- @success="handlePaySuccess"
- />
- </CommonTopBanner>
- </template>
- <script setup lang="ts">
- import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
- import { useRequireLogin } from '@/common/composeabe/RequireLogin';
- import { ref } from 'vue';
- import { navTo, 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 FlexRow from '@/components/layout/FlexRow.vue';
- import Button from '@/components/basic/Button.vue';
- import Image from '@/components/basic/Image.vue';
- import DirectPayDialog from './dialogs/DirectPayDialog.vue';
- import TreeApi from '@/api/light/TreeApi';
- import Touchable from '@/components/feedback/Touchable.vue';
- import Icon from '@/components/basic/Icon.vue';
- const { requireLoginAsync } = useRequireLogin();
- const directPayDialog = ref<InstanceType<typeof DirectPayDialog>>();
- function handlePaySuccess() {
- setTimeout(() => {
- backAndCallOnPageBack('paySuccessAndRefresh', {});
- }, 100);
- }
- const { querys } = useLoadQuerys({
- villageId: 0,
- upgradePackageId: 0,
- }, () => {
- });
- async function handleMyOrders() {
- if (!await requireLoginAsync('登录后查看我的升级订单哦'))
- return;
- navTo('/pages/home/village/upgrade/my-orders', {
- villageId: querys.value.villageId,
- });
- }
- async function handleDirectPay(payType: 1 | 3) {
- if (!requireLoginAsync('登录后为村社升级,做出你的贡献哦'))
- return;
- try {
- uni.showLoading({ title: '创建订单中...' });
- const result = await TreeApi.createUpgradeOrder(
- querys.value.villageId,
- querys.value.upgradePackageId,
- payType,
- );
- if (payType === 1) {
- directPayDialog.value?.open(result.order.id);
- } else {
- directPayDialog.value?.openSuccess();
- }
- } catch (e) {
- showError(e);
- } finally {
- uni.hideLoading();
- }
- }
- function handlePublicPay() {
- if (!requireLoginAsync('登录后为村社升级,做出你的贡献哦'))
- return;
- navTo('/pages/home/village/upgrade/pay-public', {
- villageId: querys.value.villageId,
- upgradePackageId: querys.value.upgradePackageId,
- });
- }
- defineExpose({
- onPageBack(name: string, data: any) {
- if (name === 'handlePaySuccess') {
- handlePaySuccess();
- }
- },
- });
- </script>
|