Преглед изворни кода

📦 对接乡源果支付1

快乐的梦鱼 пре 5 дана
родитељ
комит
0ba9a6560b

+ 2 - 1
src/api/light/OfficialApi.ts

@@ -329,13 +329,14 @@ export class OfficialApi extends AppServerRequestModule<DataModel> {
    * 个人升级村社管理
    * 个人升级村社管理
    * @param staffLevelId 管理等级ID: 1=村社管理, 2=测试
    * @param staffLevelId 管理等级ID: 1=村社管理, 2=测试
    */
    */
-  async upgradeStaff(villageId: number, staffLevelId = 1) {
+  async upgradeStaff(villageId: number, staffLevelId = 1, payType: 1 | 3 = 1) {
     const res = await this.post<{
     const res = await this.post<{
       order: KeyValue,
       order: KeyValue,
       pay: WxPayParams,
       pay: WxPayParams,
     }>('/village/growth/staff', '升级村社管理', {
     }>('/village/growth/staff', '升级村社管理', {
       village_id: villageId,
       village_id: villageId,
       staff_level_id: staffLevelId,
       staff_level_id: staffLevelId,
+      pay_type: payType,
     });
     });
     const data = res.requireData();
     const data = res.requireData();
     return {
     return {

+ 3 - 2
src/api/light/TreeApi.ts

@@ -738,10 +738,11 @@ export class TreeApi extends AppServerRequestModule<DataModel> {
   }
   }
 
 
   /** 下单赐福套餐 */
   /** 下单赐福套餐 */
-  async createBlessOrder(villageId: number, blessId: number) {
+  async createBlessOrder(villageId: number, blessId: number, payType: 1 | 2 | 3) {
     const res = await this.post<KeyValue>('/village/growth/bless', '下单赐福', {
     const res = await this.post<KeyValue>('/village/growth/bless', '下单赐福', {
       village_id: villageId,
       village_id: villageId,
       bless_id: blessId,
       bless_id: blessId,
+      pay_type: payType,
     });
     });
     const data = res.requireData();
     const data = res.requireData();
     return transformDataModel<BlessOrderConfirm>(BlessOrderConfirm, data);
     return transformDataModel<BlessOrderConfirm>(BlessOrderConfirm, data);
@@ -801,7 +802,7 @@ export class TreeApi extends AppServerRequestModule<DataModel> {
   async createUpgradeOrder(
   async createUpgradeOrder(
     villageId: number,
     villageId: number,
     upgradeLevelId: number,
     upgradeLevelId: number,
-    payType: 1 | 2,
+    payType: 1 | 2 | 3,
   ) {
   ) {
     const res = await this.post<KeyValue>('/village/growth/upgrade', '升级订单下单', {
     const res = await this.post<KeyValue>('/village/growth/upgrade', '升级订单下单', {
       village_id: villageId,
       village_id: villageId,

+ 7 - 0
src/pages/home/discover/details.vue

@@ -99,6 +99,12 @@
               :content="(loader.content.value.overview as string)"
               :content="(loader.content.value.overview as string)"
             />
             />
             <Text v-if="emptyContent">暂无简介</Text>
             <Text v-if="emptyContent">暂无简介</Text>
+
+            <FlexRow gap="gap.md">
+              <Icon icon="info" size="40" />
+              <Text v-if="true" fontConfig="subText" text="本文章仅代表作者个人观点,暂未通过村(社区)审核" />
+              <Text v-else fontConfig="subText" text="本文章仅代表作者个人观点" />
+            </FlexRow>
           </FlexCol>
           </FlexCol>
           
           
           <!-- 推荐 -->
           <!-- 推荐 -->
@@ -152,6 +158,7 @@ import StatusBarSpace from "@/components/layout/space/StatusBarSpace.vue";
 import NavBar from "@/components/nav/NavBar.vue";
 import NavBar from "@/components/nav/NavBar.vue";
 import LikeFooter from "./components/LikeFooter.vue";
 import LikeFooter from "./components/LikeFooter.vue";
 import Height from "@/components/layout/space/Height.vue";
 import Height from "@/components/layout/space/Height.vue";
+import Icon from "@/components/basic/Icon.vue";
 
 
 const { onPreviewImage } = useSwiperImagePreview(() => loader.content.value?.images || []);
 const { onPreviewImage } = useSwiperImagePreview(() => loader.content.value?.images || []);
 const emptyContent = computed(() => 
 const emptyContent = computed(() => 

+ 5 - 1
src/pages/home/village/bless/dialogs/DirectPayDialog.vue

@@ -6,7 +6,10 @@
         <Height :height="10" />
         <Height :height="10" />
         <FlexCol gap="gap.md">
         <FlexCol gap="gap.md">
           <BoxMid direction="row" justify="space-between">
           <BoxMid direction="row" justify="space-between">
-            <Text text="微信支付" fontConfig="lightImportantTitle" :fontSize="42" />
+            <FlexRow align="center">
+              <Icon icon="wechat" size="40" />
+              <Text text="微信支付" fontConfig="lightImportantTitle" :fontSize="42" />
+            </FlexRow>
             <CheckBox :modelValue="payMethod == 'wechat'" shape="round" @update="payMethod = 'wechat'" />
             <CheckBox :modelValue="payMethod == 'wechat'" shape="round" @update="payMethod = 'wechat'" />
           </BoxMid>
           </BoxMid>
         </FlexCol>
         </FlexCol>
@@ -44,6 +47,7 @@ import BoxMid from "@/common/components/box/BoxMid.vue";
 import TreeApi from "@/api/light/TreeApi";
 import TreeApi from "@/api/light/TreeApi";
 import CheckBox from "@/components/form/CheckBox.vue";
 import CheckBox from "@/components/form/CheckBox.vue";
 import type { BlessOrderConfirm } from "@/api/light/TreeApi";
 import type { BlessOrderConfirm } from "@/api/light/TreeApi";
+import Icon from "@/components/basic/Icon.vue";
 
 
 const emit = defineEmits(['success']);
 const emit = defineEmits(['success']);
 
 

+ 1 - 1
src/pages/home/village/introd/tree.vue

@@ -274,7 +274,7 @@ async function handleBuyBlessConfirm() {
     uni.showLoading({
     uni.showLoading({
       title: '请稍后...',
       title: '请稍后...',
     });
     });
-    const payInfo = await TreeApi.createBlessOrder(villageStore.currentVillage?.id, currentBless.value.id);
+    const payInfo = await TreeApi.createBlessOrder(villageStore.currentVillage?.id, currentBless.value.id, 1);
     if (payInfo) {  
     if (payInfo) {  
       uni.requestPayment({
       uni.requestPayment({
         provider: 'wxpay',
         provider: 'wxpay',

+ 11 - 1
src/pages/home/village/upgrade/dialogs/DirectPayDialog.vue

@@ -6,7 +6,10 @@
         <Height :height="10" />
         <Height :height="10" />
         <FlexCol gap="gap.md">
         <FlexCol gap="gap.md">
           <BoxMid direction="row" justify="space-between">
           <BoxMid direction="row" justify="space-between">
-            <Text text="微信支付" fontConfig="lightImportantTitle" :fontSize="42" />
+            <FlexRow align="center">
+              <Icon icon="wechat" size="40" />
+              <Text text="微信支付" fontConfig="lightImportantTitle" :fontSize="42" />
+            </FlexRow>
             <CheckBox :modelValue="payMethod == 'wechat'" shape="round" @update="payMethod = 'wechat'" />
             <CheckBox :modelValue="payMethod == 'wechat'" shape="round" @update="payMethod = 'wechat'" />
           </BoxMid>
           </BoxMid>
         </FlexCol>
         </FlexCol>
@@ -33,6 +36,7 @@
 import { ref } from "vue";
 import { ref } from "vue";
 import { toast } from "@/components/dialog/CommonRoot";
 import { toast } from "@/components/dialog/CommonRoot";
 import { showError } from "@/common/composeabe/ErrorDisplay";
 import { showError } from "@/common/composeabe/ErrorDisplay";
+import { useAuthStore } from "@/store/auth";
 import CommonDialog from "@/common/components/CommonDialog.vue";
 import CommonDialog from "@/common/components/CommonDialog.vue";
 import FrameButton from "@/common/components/FrameButton.vue";
 import FrameButton from "@/common/components/FrameButton.vue";
 import FlexCol from "@/components/layout/FlexCol.vue";
 import FlexCol from "@/components/layout/FlexCol.vue";
@@ -44,8 +48,10 @@ import BoxMid from "@/common/components/box/BoxMid.vue";
 import TreeApi from "@/api/light/TreeApi";
 import TreeApi from "@/api/light/TreeApi";
 import CheckBox from "@/components/form/CheckBox.vue";
 import CheckBox from "@/components/form/CheckBox.vue";
 import type { UpgradeOrderConfirm } from "@/api/light/TreeApi";
 import type { UpgradeOrderConfirm } from "@/api/light/TreeApi";
+import Icon from "@/components/basic/Icon.vue";
 
 
 const emit = defineEmits(['success']);
 const emit = defineEmits(['success']);
+const authStore = useAuthStore();
 
 
 const show = ref(false);
 const show = ref(false);
 const uploadStep = ref<'form' | 'finished'>('form');
 const uploadStep = ref<'form' | 'finished'>('form');
@@ -98,5 +104,9 @@ defineExpose({
     uploadStep.value = 'form';
     uploadStep.value = 'form';
     show.value = true;
     show.value = true;
   },
   },
+  openSuccess() {
+    show.value = true;
+    uploadStep.value = 'finished';
+  },
 });
 });
 </script>
 </script>

+ 3 - 1
src/pages/home/village/upgrade/my-orders.vue

@@ -20,7 +20,9 @@
             <FlexCol>
             <FlexCol>
               <Text fontConfig="lightImportantTitle" fontFamily="SongtiSCBlack">{{ item.levelName }}</Text>
               <Text fontConfig="lightImportantTitle" fontFamily="SongtiSCBlack">{{ item.levelName }}</Text>
               <Text :fontSize="23" :text="`${item.villageName} ${item.vipLevel}级`" />
               <Text :fontSize="23" :text="`${item.villageName} ${item.vipLevel}级`" />
-              <Text :fontSize="21" fontConfig="secondText">{{ item.payType === 1 ? '线上支付' : '对公付款' }}</Text>
+              <Text v-if="item.payType === 1" :fontSize="21" fontConfig="secondText">线上支付</Text>
+              <Text v-else-if="item.payType === 2" :fontSize="21" fontConfig="secondText">对公付款</Text>
+              <Text v-else-if="item.payType === 3" :fontSize="21" fontConfig="secondText">乡源果支付</Text>
             </FlexCol>
             </FlexCol>
             <FlexRow gap="gap.xl">
             <FlexRow gap="gap.xl">
               <FlexCol align="flex-end">
               <FlexCol align="flex-end">

+ 23 - 16
src/pages/home/village/upgrade/my-upgrade-management.vue

@@ -22,29 +22,29 @@
       </FlexCol>
       </FlexCol>
 
 
       <FlexCol gap="gap.md">
       <FlexCol gap="gap.md">
-        <BoxMid
-          direction="row"
-          justify="space-between"
-          align="center"
-          gap="gap.md"
-        >
+        <BoxMid direction="row" justify="space-between" align="center" gap="gap.md">
           <FlexCol width="74%">
           <FlexCol width="74%">
             <Text text="在线支付" fontConfig="lightImportantTitle" :fontSize="42" />
             <Text text="在线支付" fontConfig="lightImportantTitle" :fontSize="42" />
             <Text text="推荐使用微信线支付方式,方便快捷,立即生效" fontConfig="lightGoldTitle" :fontSize="30" />
             <Text text="推荐使用微信线支付方式,方便快捷,立即生效" fontConfig="lightGoldTitle" :fontSize="30" />
           </FlexCol>
           </FlexCol>
-          <FrameButton primary text="选择" @click="handleDirectPay(1)" />
+          <FrameButton primary text="选择" @click="handleDirectPay(1, 1)" />
         </BoxMid>
         </BoxMid>
-        <BoxMid
-          direction="row"
-          justify="space-between"
-          align="center"
-          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="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(1, 3)" />
+        </BoxMid>
+        <BoxMid direction="row" justify="space-between" align="center" gap="gap.md">
           <FlexCol width="74%">
           <FlexCol width="74%">
             <Text text="测试" fontConfig="lightImportantTitle" :fontSize="42" />
             <Text text="测试" fontConfig="lightImportantTitle" :fontSize="42" />
             <Text text="¥ 0.01" fontConfig="lightGoldTitle" :fontSize="30" />
             <Text text="¥ 0.01" fontConfig="lightGoldTitle" :fontSize="30" />
           </FlexCol>
           </FlexCol>
-          <FrameButton primary text="选择" @click="handleDirectPay(2)" />
+          <FrameButton primary text="选择" @click="handleDirectPay(2, 1)" />
         </BoxMid>
         </BoxMid>
       </FlexCol>
       </FlexCol>
     </FlexCol>
     </FlexCol>
@@ -68,6 +68,8 @@ import Text from '@/components/basic/Text.vue';
 import FlexCol from '@/components/layout/FlexCol.vue';
 import FlexCol from '@/components/layout/FlexCol.vue';
 import OfficialApi from '@/api/light/OfficialApi';
 import OfficialApi from '@/api/light/OfficialApi';
 import UpgradeManagementSuccessDialog from './dialogs/UpgradeManagementSuccess.vue';
 import UpgradeManagementSuccessDialog from './dialogs/UpgradeManagementSuccess.vue';
+import FlexRow from '@/components/layout/FlexRow.vue';
+import Icon from '@/components/basic/Icon.vue';
 
 
 const upgradeManagementSuccessDialog = ref<InstanceType<typeof UpgradeManagementSuccessDialog>>();
 const upgradeManagementSuccessDialog = ref<InstanceType<typeof UpgradeManagementSuccessDialog>>();
 
 
@@ -93,7 +95,7 @@ async function handleMyOrders() {
   });
   });
 }
 }
 
 
-async function handleDirectPay(levelType: number) {
+async function handleDirectPay(levelType: number, payType: 1 | 3) {
   if (!requireLoginAsync('登录后为村社升级,做出你的贡献哦'))
   if (!requireLoginAsync('登录后为村社升级,做出你的贡献哦'))
     return;
     return;
   try {
   try {
@@ -101,8 +103,11 @@ async function handleDirectPay(levelType: number) {
     const { order: orderInfo, pay: payInfo } = await OfficialApi.upgradeStaff(
     const { order: orderInfo, pay: payInfo } = await OfficialApi.upgradeStaff(
       querys.value.villageId,
       querys.value.villageId,
       levelType,
       levelType,
+      payType,
     );
     );
-    if (payInfo) {
+    if (payType === 1) {
+      if (!payInfo) 
+        throw new Error('支付信息不存在');
       uni.requestPayment({
       uni.requestPayment({
         provider: 'wxpay',
         provider: 'wxpay',
         appId: payInfo.appId,
         appId: payInfo.appId,
@@ -118,6 +123,8 @@ async function handleDirectPay(levelType: number) {
           showError(`支付失败: ${err.errMsg}`);
           showError(`支付失败: ${err.errMsg}`);
         },
         },
       });
       });
+    } else if (payType === 3) { 
+      upgradeManagementSuccessDialog.value?.open();
     }
     }
   } catch (e) {
   } catch (e) {
     showError(e);
     showError(e);

+ 24 - 11
src/pages/home/village/upgrade/select.vue

@@ -21,17 +21,25 @@
       </FlexCol>
       </FlexCol>
 
 
       <FlexCol gap="gap.md">
       <FlexCol gap="gap.md">
-        <BoxMid
-          direction="row"
-          justify="space-between"
-          align="center"
-          gap="gap.md"
-        >
+        <BoxMid direction="row" justify="space-between" align="center" gap="gap.md">
           <FlexCol width="74%">
           <FlexCol width="74%">
-            <Text text="在线支付" fontConfig="lightImportantTitle" :fontSize="42" />
+            <FlexRow align="center" gap="gap.md">
+              <Icon icon="wechat" size="36" />
+              <Text text="在线支付" fontConfig="lightImportantTitle" :fontSize="42" />
+            </FlexRow>
             <Text text="推荐使用微信线支付方式,方便快捷,立即生效" fontConfig="lightGoldTitle" :fontSize="30" />
             <Text text="推荐使用微信线支付方式,方便快捷,立即生效" fontConfig="lightGoldTitle" :fontSize="30" />
           </FlexCol>
           </FlexCol>
-          <FrameButton primary text="选择" @click="handleDirectPay" />
+          <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>
         <BoxMid
         <BoxMid
           v-if="false"
           v-if="false"
@@ -73,6 +81,7 @@ import Image from '@/components/basic/Image.vue';
 import DirectPayDialog from './dialogs/DirectPayDialog.vue';
 import DirectPayDialog from './dialogs/DirectPayDialog.vue';
 import TreeApi from '@/api/light/TreeApi';
 import TreeApi from '@/api/light/TreeApi';
 import Touchable from '@/components/feedback/Touchable.vue';
 import Touchable from '@/components/feedback/Touchable.vue';
+import Icon from '@/components/basic/Icon.vue';
 
 
 const { requireLoginAsync } = useRequireLogin();
 const { requireLoginAsync } = useRequireLogin();
 
 
@@ -99,7 +108,7 @@ async function handleMyOrders() {
   });
   });
 }
 }
 
 
-async function handleDirectPay() {
+async function handleDirectPay(payType: 1 | 3) {
   if (!requireLoginAsync('登录后为村社升级,做出你的贡献哦'))
   if (!requireLoginAsync('登录后为村社升级,做出你的贡献哦'))
     return;
     return;
   try {
   try {
@@ -107,9 +116,13 @@ async function handleDirectPay() {
     const result = await TreeApi.createUpgradeOrder(
     const result = await TreeApi.createUpgradeOrder(
       querys.value.villageId,
       querys.value.villageId,
       querys.value.upgradePackageId,
       querys.value.upgradePackageId,
-      1,
+      payType,
     );
     );
-    directPayDialog.value?.open(result.order.id);
+    if (payType === 1) {
+      directPayDialog.value?.open(result.order.id);
+    } else {
+      directPayDialog.value?.openSuccess();
+    }
   } catch (e) {
   } catch (e) {
     showError(e);
     showError(e);
   } finally {
   } finally {