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

🎨 按要求修改优先显示乡源果

快乐的梦鱼 пре 1 месец
родитељ
комит
a7eae12154

+ 13 - 0
src/pages/home/composeabe/FruitConverit.ts

@@ -0,0 +1,13 @@
+export function useFruitConversion() {
+  function moneyToFruit(money: number) {
+    return Math.ceil(money * 100);
+  }
+  function fruitToMoney(fruit: number) {
+    return Math.ceil(fruit / 100);
+  }
+
+  return {
+    moneyToFruit,
+    fruitToMoney,
+  };
+}

+ 1 - 1
src/pages/home/village/bless/pay-select.vue

@@ -23,7 +23,7 @@
                 <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>
             <FrameButton primary text="选择" @click="handleDirectPay(1)" />
           </BoxMid>

+ 4 - 2
src/pages/home/village/upgrade/components/BuyFruitInfo.vue

@@ -1,6 +1,5 @@
 <template>
   <FlexCol gap="gap.md">
-    <slot name="prepend" />
     <BoxMid direction="row" justify="space-between" align="center" gap="gap.md">
       <FlexCol width="74%">
         <FlexRow align="center" gap="gap.md">
@@ -8,13 +7,14 @@
           <Text text="乡源果支付" fontConfig="lightImportantTitle" :fontSize="42" />
         </FlexRow>
         <Text :text="`余额 ${authStore.userInfo?.fruit || '0'} 乡源果`" fontConfig="lightGoldTitle" :fontSize="30" />
-        <Text v-if="price" :text="`需要 ${Math.ceil(price * 100)} 乡源果`" fontConfig="lightGoldTitle" :fontSize="30" />   
+        <Text v-if="price" :text="`需要 ${moneyToFruit(price)} 乡源果`" fontConfig="lightGoldTitle" :fontSize="30" />   
       </FlexCol>
       <FlexRow align="center" gap="gap.md">
         <Text v-if="price && price > (authStore.userInfo?.fruit || 0)" text="乡源果不足" fontConfig="lightGoldTitle" :fontSize="30" color="danger" />
         <FrameButton v-else primary text="选择" @click="emit('pay')" />
       </FlexRow>
     </BoxMid>      
+    <slot name="prepend" />
     <SimplePageContentLoader :loader="infoLoader">
       <FlexCol gap="gap.md" padding="padding.md">
         <IconTextBlock icon="prompt" :iconProps="{ 
@@ -41,12 +41,14 @@ import SimplePageContentLoader from '@/components/loader/SimplePageContentLoader
 import FlexRow from '@/components/layout/FlexRow.vue';
 import { useAuthStore } from '@/store/auth';
 import IconTextBlock from '@/components/display/block/IconTextBlock.vue';
+import { useFruitConversion } from '@/pages/home/composeabe/FruitConverit';
 
 const emit = defineEmits(['pay']);
 const props = defineProps<{
   price?: number;
 }>()
   
+const { moneyToFruit } = useFruitConversion();
 const authStore = useAuthStore();
 const infoLoader = useSimpleDataLoader(async () => await CommonContent.getContentDetail(7023, undefined, 18));
 </script>

+ 12 - 5
src/pages/home/village/upgrade/my-upgrade-management.vue

@@ -27,11 +27,12 @@
               <Text :text="`${item.timeTypeText === '限时' ? `临时 ${item.days} 天管理员` : '永久'}`" :fontSize="32" :color="item.timeTypeText === '永久' ? 'warning' : 'success'" />
             </FlexCol>
             <FlexRow align="center" gap="gap.md">
-              <Tag v-if="item.pointsLimit > 0" :text="`${item.pointsLimit}积分/乡源果`" :type="isPointEnough(item.pointsLimit) ? 'success' : 'danger'" />
+              <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" />
+            <Icon icon="https://xy.wenlvti.net/app_static/images/village/IconFruit.png" :size="40" />
+            <Text :text="moneyToFruit(item.price)" fontConfig="lightGoldTitle" :fontSize="40" />
             <FrameButton primary text="选择" @click="handleChoose(item)" />
           </FlexRow>
         </BoxMid>
@@ -51,7 +52,7 @@
             <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" />
+                <Text text="若乡源果不足,还支持微信线支付方式,立即生效" fontConfig="lightGoldTitle" :fontSize="30" />
               </FlexCol>
               <FrameButton primary text="选择" @click="handleDirectPay(1)" />
             </BoxMid>
@@ -85,11 +86,15 @@ import UpgradeManagementSuccessDialog from './dialogs/UpgradeManagementSuccess.v
 import BuyFruitInfo from './components/BuyFruitInfo.vue';
 import FlexRow from '@/components/layout/FlexRow.vue';
 import Tag from '@/components/display/Tag.vue';
+import Icon from '@/components/basic/Icon.vue';
+import { useFruitConversion } from '../../composeabe/FruitConverit';
+import { waitTimeOut } from '@imengyu/imengyu-utils';
 
 const upgradeManagementSuccessDialog = ref<InstanceType<typeof UpgradeManagementSuccessDialog>>();
 
 const { requireLoginAsync } = useRequireLogin();
 const { volunteerInfo } = useVolunteerInfo();
+const { moneyToFruit } = useFruitConversion();
 
 function handlePaySuccess() {
   setTimeout(() => {
@@ -119,8 +124,7 @@ function handleBack() {
   else 
     back();
 }
-function handleChoose(level: StaffLevelItem) {
-  console.log(level,volunteerInfo.value );
+async function handleChoose(level: StaffLevelItem) {
   if (level.pointsLimit > 0 && !isPointEnough(level.pointsLimit)) {
     showError(
       '您的积分不足,现有 ' + (volunteerInfo.value?.points || 0) + 
@@ -128,8 +132,11 @@ function handleChoose(level: StaffLevelItem) {
     return;
   }
 
+  uni.showLoading({ title: '请稍后...' });
   step.value = 'pay';
   choosedLevel.value = level;
+  await waitTimeOut(1000);
+  uni.hideLoading();
 }
 async function handleDirectPay(payType: 1 | 3) {
   if (!requireLoginAsync('登录后为村社升级,做出你的贡献哦'))

+ 1 - 1
src/pages/home/village/upgrade/select.vue

@@ -28,7 +28,7 @@
                 <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>
             <FrameButton primary text="选择" @click="handleDirectPay(1)" />
           </BoxMid>