select.vue 5.0 KB

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