select.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <CommonTopBanner
  3. title="升级村社"
  4. showNav
  5. >
  6. <FlexCol gap="gap.lg" padding="padding.md">
  7. <FlexRow justify="flex-end">
  8. <Button icon="https://xy.wenlvti.net/app_static/images/home/IconOrder.png" text="我的订单" @click="handleMyOrders()" />
  9. </FlexRow>
  10. <FlexRow center>
  11. <Image src="https://xy.wenlvti.net/app_static/images/village/IconBlessing.png" :width="100" :height="100" />
  12. </FlexRow>
  13. <FlexCol padding="padding.md" center>
  14. <Text
  15. text="感谢您选择升级村社,请选择您要付款方式"
  16. fontConfig="contentText" :fontSize="30" textAlign="center"
  17. />
  18. </FlexCol>
  19. <FlexCol gap="gap.md">
  20. <BoxMid
  21. direction="row"
  22. justify="space-between"
  23. align="center"
  24. gap="gap.md"
  25. >
  26. <FlexCol width="74%">
  27. <Text text="在线支付" fontConfig="lightImportantTitle" :fontSize="42" />
  28. <Text text="推荐使用微信线支付方式,方便快捷,立即生效" fontConfig="lightGoldTitle" :fontSize="30" />
  29. </FlexCol>
  30. <FrameButton primary text="选择" @click="handleDirectPay" />
  31. </BoxMid>
  32. <BoxMid
  33. direction="row"
  34. justify="space-between"
  35. align="center"
  36. gap="gap.md"
  37. >
  38. <FlexCol width="74%">
  39. <Text text="对公打款" fontConfig="lightImportantTitle" :fontSize="42" />
  40. <Text text="对公打款,需要提供对公账户信息。适用于村社政府做出贡献" fontConfig="lightGoldTitle" :fontSize="30" />
  41. </FlexCol>
  42. <FrameButton primary text="选择" @click="handlePublicPay" />
  43. </BoxMid>
  44. </FlexCol>
  45. </FlexCol>
  46. <DirectPayDialog
  47. ref="directPayDialog"
  48. @success="handlePaySuccess"
  49. />
  50. </CommonTopBanner>
  51. </template>
  52. <script setup lang="ts">
  53. import { useLoadQuerys } from '@/components/composeabe/LoadQuerys';
  54. import { useRequireLogin } from '@/common/composeabe/RequireLogin';
  55. import { ref } from 'vue';
  56. import { navTo, backAndCallOnPageBack } from '@/components/utils/PageAction';
  57. import { showError } from '@/common/composeabe/ErrorDisplay';
  58. import BoxMid from '@/common/components/box/BoxMid.vue';
  59. import CommonTopBanner from '@/common/components/CommonTopBanner.vue';
  60. import FrameButton from '@/common/components/FrameButton.vue';
  61. import Text from '@/components/basic/Text.vue';
  62. import FlexCol from '@/components/layout/FlexCol.vue';
  63. import FlexRow from '@/components/layout/FlexRow.vue';
  64. import Button from '@/components/basic/Button.vue';
  65. import Image from '@/components/basic/Image.vue';
  66. import DirectPayDialog from './dialogs/DirectPayDialog.vue';
  67. import TreeApi from '@/api/light/TreeApi';
  68. import Touchable from '@/components/feedback/Touchable.vue';
  69. const { requireLoginAsync } = useRequireLogin();
  70. const directPayDialog = ref<InstanceType<typeof DirectPayDialog>>();
  71. function handlePaySuccess() {
  72. setTimeout(() => {
  73. backAndCallOnPageBack('paySuccessAndRefresh', {});
  74. }, 100);
  75. }
  76. const { querys } = useLoadQuerys({
  77. villageId: 0,
  78. upgradePackageId: 0,
  79. }, () => {
  80. });
  81. async function handleMyOrders() {
  82. if (!await requireLoginAsync('登录后查看我的升级订单哦'))
  83. return;
  84. navTo('/pages/home/village/upgrade/my-orders', {
  85. villageId: querys.value.villageId,
  86. });
  87. }
  88. async function handleDirectPay() {
  89. if (!requireLoginAsync('登录后为村社升级,做出你的贡献哦'))
  90. return;
  91. try {
  92. uni.showLoading({ title: '创建订单中...' });
  93. const result = await TreeApi.createUpgradeOrder(
  94. querys.value.villageId,
  95. querys.value.upgradePackageId,
  96. 1,
  97. );
  98. directPayDialog.value?.open(result.order.id);
  99. } catch (e) {
  100. showError(e);
  101. } finally {
  102. uni.hideLoading();
  103. }
  104. }
  105. function handlePublicPay() {
  106. if (!requireLoginAsync('登录后为村社升级,做出你的贡献哦'))
  107. return;
  108. navTo('/pages/home/village/upgrade/pay-public', {
  109. villageId: querys.value.villageId,
  110. upgradePackageId: querys.value.upgradePackageId,
  111. });
  112. }
  113. defineExpose({
  114. onPageBack(name: string, data: any) {
  115. if (name === 'handlePaySuccess') {
  116. handlePaySuccess();
  117. }
  118. },
  119. });
  120. </script>