Просмотр исходного кода

Merge branch 'dev' of http://git.izouma.com/xiongzhu/paimaide into dev

panhui 2 лет назад
Родитель
Сommit
34a140145c
6 измененных файлов с 114 добавлено и 113 удалено
  1. 2 1
      .env.development
  2. BIN
      android/app/src/main/assets/cdvasset.manifest
  3. 1 1
      public/meta.js
  4. 5 7
      src/locales/en.json
  5. 4 6
      src/locales/zh.json
  6. 102 98
      src/views/BLFPage.vue

+ 2 - 1
.env.development

@@ -1,3 +1,4 @@
 BASE_URL=/h5/
 VITE_BASE_URL=/h5/
-VITE_HTTP_BASE_URL=http://35.76.121.189/
+VITE_HTTP_BASE_URL=https://paimaide.izouma.com/
+#本地新建一个.env.development.local文件,用于覆盖上面的配置,不要直接修改.env.development文件

BIN
android/app/src/main/assets/cdvasset.manifest


+ 1 - 1
public/meta.js

@@ -1 +1 @@
-window.www_version = 1116
+window.www_version = 1117

+ 5 - 7
src/locales/en.json

@@ -59,8 +59,8 @@
         "invalidCard": "Invalid Account"
     },
     "blf": {
-        "buy": "Snap up now",
-        "buying": "snapped up, income",
+        "buy": "STAKE NOW",
+        "buying": "STAKING",
         "computing": "Calculating Profit",
         "end": "Activity has ended",
         "finish": "sold out",
@@ -72,8 +72,8 @@
         "tips": "Stake your balance through the overall stake balance ratio of the platform. Get {rate}‰ of the stake amount of that day.",
         "amount": "Enter stake amount",
         "minAmount": "minimum stake amount: ",
-        "sure": "Confirm",
-        "time": "Choose a stake duration"
+        "time": "Choose a stake duration",
+        "promptAmount": "Please enter stake amount"
     },
     "common": {
         "alert": "Hint",
@@ -119,9 +119,7 @@
         "sellPrice": "Selling Price",
         "tip": "The consignment has not started yet, it will start today at {time}",
         "tip1": "Note: entrusting the platform to sell services, the maximum price of the product can be increased by {riseRatePercent}% each time, and the platform will charge {serviceCharge}% of the custody service fee",
-        "title": "Consignment",
-        "tips2": "Your collection will be available for sale in ",
-        "tips3": " hours"
+        "title": "Consignment"
     },
     "distribution": {
         "commission": "Commission",

+ 4 - 6
src/locales/zh.json

@@ -59,8 +59,8 @@
         "invalidAccount": "无效的银行卡号"
     },
     "blf": {
-        "buy": "立即抢购",
-        "buying": "已抢购,收益",
+        "buy": "立即质押",
+        "buying": "质押中",
         "computing": "收益计算中",
         "end": "已结束",
         "finish": "已抢光",
@@ -73,7 +73,7 @@
         "amount": "输入质押金额",
         "minAmount": "最低质押金额:",
         "time": "选择质押时长",
-        "sure": "确认"
+        "promptAmount": "请输入质押金额"
     },
     "common": {
         "alert": "提示",
@@ -119,9 +119,7 @@
         "sellPrice": "卖价",
         "tip": "委托代卖暂未开始,将在今天{time}开始",
         "tip1": "注:委托平台代卖服务,每次最高可将商品价格提高{riseRatePercent}%,平台会收取{serviceCharge}%的托管服务费用",
-        "title": "委托代卖",
-        "tips2": "上架藏品将被冷冻",
-        "tips3": "小时"
+        "title": "委托代卖"
     },
     "distribution": {
         "commission": "佣金",

+ 102 - 98
src/views/BLFPage.vue

@@ -54,9 +54,9 @@
                 }}</van-button>
             </div>
         </ion-content>
-        <ion-modal :is-open="showPayModal" class="pay-modal" @didDismiss="showPayModal = false">
-            <ion-content :scrollY="false">
-                <div class="pay-box">
+        <ion-modal class="stake-modal" :is-open="showPayModal" @didDismiss="showPayModal = false">
+            <div class="stake-modal-wrapper">
+                <div class="stake-modal-content">
                     <div class="title">
                         <div class="text1">{{ $t('blf.amount') }}</div>
                         <div class="text2">{{ $t('blf.minAmount') + $t('balance.symbol') + minAmount }}</div>
@@ -65,27 +65,29 @@
                     <div class="close" @click="showPayModal = false">
                         <img src="@/assets/icon_close2.png" alt="" />
                     </div>
-                    <van-stepper
-                        :min="minAmount"
-                        :max="now"
-                        :show-plus="false"
-                        :show-minus="false"
-                        v-model="stakeAmount"
-                    />
+                    <van-field class="amount-filed" type="digit" v-model="stakeAmount" autofocus />
                     <div class="title">
                         <div class="text1">{{ $t('blf.time') }}</div>
                     </div>
                     <div class="time-list">
-                        <div class="time-item" v-for="item in stakeTimes" :key="item" @click="stakeTime = item">
-                            <img :src="item === stakeTime ? activeIcon : icon" alt="" />
-                            <span>{{ getHours(item) + $t('delegate.tips3') }}</span>
+                        <div
+                            class="time-item"
+                            v-for="item in productInfo?.stakeOptions || []"
+                            :key="item"
+                            @click="stakeTime = item.duration"
+                        >
+                            <img :src="item.duration === stakeTime ? activeIcon : icon" alt="" />
+                            <span class="duration">{{
+                                formatDuration({ hours: item.duration / 60 }, { format: ['hours'] })
+                            }}</span>
+                            <span class="profit">{{ item.rate * 1000 }}‰ {{ $t('rank.profit') }}</span>
                         </div>
                     </div>
                     <div class="footer">
-                        <van-button type="primary" block @click="pay">{{ $t('blf.sure') }}</van-button>
+                        <van-button type="primary" block @click="stake">{{ $t('common.confirm') }}</van-button>
                     </div>
                 </div>
-            </ion-content>
+            </div>
         </ion-modal>
     </ion-page>
 </template>
@@ -98,7 +100,7 @@ import http from '@/plugins/http'
 import { useIonRouter } from '@ionic/vue'
 import { useWindowSize } from '@vueuse/core'
 import { onIonViewWillEnter } from '@ionic/vue'
-import { differenceInMilliseconds, differenceInSeconds } from 'date-fns'
+import { differenceInMilliseconds, differenceInSeconds, formatDuration } from 'date-fns'
 import { useUserStore } from '@/stores/user'
 import { accDiv, accMul } from '@/plugins/calc'
 import { closeOutline } from 'ionicons/icons'
@@ -128,10 +130,13 @@ const buy = () => {
         showPayModal.value = true
     }
 }
-const stakeAmount = ref(0)
+const stakeAmount = ref(null)
 const stakeTime = ref(720)
-const stakeTimes = ref([720, 1080, 1440])
-function pay() {
+function stake() {
+    if (!stakeAmount.value) {
+        Toast(t('blf.promptAmount'))
+        return
+    }
     Toast.loading({
         message: t('common.loading') + '...',
         forbidClick: true
@@ -163,12 +168,15 @@ function onFinish() {
 const productInfo = ref({})
 const time = ref(0)
 const rate = ref(0)
-const minAmount = ref(1)
+const minAmount = ref(null)
 function init() {
     http.http
         .get('/financeProduct/today')
         .then(res => {
             productInfo.value = res
+            if (res.stakeOptions && res.stakeOptions.length > 0) {
+                stakeTime.value = res.stakeOptions[res.stakeOptions.length - 1].duration
+            }
             total.value = res.amount
             now.value = res.amount - res.saleAmount
             if (res.status === 'PENDING') {
@@ -360,90 +368,86 @@ ion-content {
     }
 }
 
-ion-modal {
-    --height: 330px;
+.stake-modal {
+    --height: fit-content;
     --border-radius: 8px;
     --width: 80vw;
+}
+.stake-modal-wrapper {
+    background: linear-gradient(90deg, rgba(219, 255, 206, 1), rgba(61, 243, 188, 1));
+    padding: 2px;
+}
+.stake-modal-content {
+    background-color: #2c302f;
+    border-radius: 8px;
+    padding: 24px 16px;
+
+    .title {
+        .text1 {
+            font-size: 18px;
+            font-weight: bold;
+            color: #ffffff;
+            line-height: 24px;
+        }
 
-    :deep(ion-content) {
-        --background: linear-gradient(90deg, rgba(219, 255, 206, 1), rgba(61, 243, 188, 1));
-        position: relative;
-        padding: 2px;
-        box-sizing: border-box;
-
-        .pay-box {
-            background-color: #2c302f;
-            border-radius: 8px;
-            position: absolute;
-            top: 2px;
-            left: 2px;
-            right: 2px;
-            bottom: 2px;
-            padding: 24px 16px;
-
-            .title {
-                .text1 {
-                    font-size: 18px;
-                    font-weight: bold;
-                    color: #ffffff;
-                    line-height: 24px;
-                }
-
-                .text2 {
-                    font-size: 12px;
-                    color: #39f3b9;
-                    line-height: 17px;
-                    margin-top: 5px;
-                }
-            }
+        .text2 {
+            font-size: 12px;
+            color: #39f3b9;
+            line-height: 17px;
+            margin-top: 5px;
+        }
+    }
 
-            .close {
-                position: absolute;
-                right: 16px;
-                top: 16px;
-                img {
-                    width: 22px;
-                    height: 22px;
-                }
-            }
+    .close {
+        position: absolute;
+        right: 16px;
+        top: 16px;
+        img {
+            width: 22px;
+            height: 22px;
+        }
+    }
 
-            .van-stepper {
-                width: 100%;
-                --van-stepper-input-width: 100%;
-                --van-stepper-input-height: 60px;
-                margin: 14px 0 24px;
-                .van-stepper__input {
-                    margin: 0 0;
-                    background: #3c403f;
-                    border-radius: 8px;
-                    border: 1px solid #4f5352;
-                    font-size: 36px;
-                    font-weight: bold;
-                    color: #39f3b9;
-                    line-height: 36px;
-                    text-align: left;
-                    padding: 0 12px;
-                }
-            }
+    .amount-filed {
+        --van-field-input-text-color: #39f3b9;
+        width: 100%;
+        margin: 14px 0 24px;
+        background: #3c403f;
+        border-radius: 8px;
+        border: 1px solid #4f5352;
+        font-size: 36px;
+        font-weight: bold;
+        line-height: 60px;
+        padding: 0 12px;
+        &::-webkit-input-placeholder {
+            font-size: 14px;
+        }
+        ::-webkit-input-placeholder {
+            font-size: 20px;
+            line-height: 60px;
+        }
+    }
 
-            .time-list {
-                .f();
-                padding: 16px 0 24px;
-                .time-item {
-                    width: 33%;
-                    .f();
-                    img {
-                        width: 24px;
-                        height: 24px;
-                        display: block;
-                    }
-                    span {
-                        font-size: 14px;
-                        color: #959797;
-                        line-height: 24px;
-                        margin-left: 4px;
-                    }
-                }
+    .time-list {
+        .f-col();
+        padding: 20px 0px;
+        .time-item {
+            .f();
+            margin-bottom: 10px;
+            font-size: 14px;
+            color: #959797;
+            line-height: 24px;
+            img {
+                width: 24px;
+                height: 24px;
+                display: block;
+            }
+            .duration {
+                margin-left: 4px;
+                flex: 1;
+            }
+            .profit {
+                text-align: right;
             }
         }
     }