nieyuge hace 2 años
padre
commit
937269bc9b
Se han modificado 3 ficheros con 45 adiciones y 23 borrados
  1. 19 7
      components/MobileBuyNft.vue
  2. 1 1
      http/index.js
  3. 25 15
      pages/payment/index.vue

+ 19 - 7
components/MobileBuyNft.vue

@@ -62,16 +62,16 @@
                                         <template v-if="item.currencyCode !== 'USD'">
                                             <template v-if="item.price.length + item.currencyInfo.tokenSymbol.length >= 30">
                                                 <div class="tr">
-                                                    <div><img class="icon" :src="item.currencyInfo.iconPath" /> {{ item.price }}</div>
-                                                    <div>{{ item.currencyInfo.tokenSymbol }} (${{item.usdPrice}})</div>
+                                                    <div><img class="icon" :src="item.currencyInfo.iconPath" /> {{ item.price | floatPrice(4) }}</div>
+                                                    <div>{{ item.currencyInfo.tokenSymbol }} (${{item.usdPrice | floatPrice(2)}})</div>
                                                 </div>
                                             </template>
                                             <template v-else>
-                                                <img class="icon" :src="item.currencyInfo.iconPath" /> {{ item.price }} {{ item.currencyInfo.tokenSymbol }} (${{item.usdPrice}})
+                                                <img class="icon" :src="item.currencyInfo.iconPath" /> {{ item.price | floatPrice(4) }} {{ item.currencyInfo.tokenSymbol }} (${{item.usdPrice | floatPrice(2)}})
                                             </template>
                                         </template>
                                         <template v-else>
-                                            ${{item.usdPrice}}
+                                            ${{item.usdPrice | floatPrice(2)}}
                                         </template>
                                     </FontZoom>
                                 </div>
@@ -82,10 +82,10 @@
                                     <div class="l">BUY {{item.itemCount}}</div>
                                     <FontZoom width="210">
                                         <template v-if="item.currencyCode !== 'USD'">
-                                            <img class="icon" :src="item.currencyInfo.iconPath" /> {{ item.price }} {{ item.currencyInfo.tokenSymbol }} (${{item.usdPrice}})
+                                            <img class="icon" :src="item.currencyInfo.iconPath" /> {{ item.price | floatPrice(4) }} {{ item.currencyInfo.tokenSymbol }} (${{item.usdPrice | floatPrice(2)}})
                                         </template>
                                         <template v-else>
-                                            ${{item.usdPrice}}
+                                            ${{item.usdPrice | floatPrice(2)}}
                                         </template>
                                     </FontZoom>
                                 </div>
@@ -170,6 +170,15 @@ export default {
             default: 0
         }
     },
+    filters: {
+        floatPrice(price, num) {
+            if (price.indexOf('.') >= 0) {
+                let reg = new RegExp(`^\\D*(\\d*(?:\\.\\d{0,${num}})?).*$`, "g");
+                price = price.replace(reg, '$1');
+            }
+            return price;
+        }
+    },
     created() {
         this.getSaleInfo()
         // report
@@ -332,11 +341,14 @@ export default {
         }
     }
     .list {
-        height: 70px;
+        height: 64px;
         margin: 0 16px;
         font-size: 0;
         overflow-x: auto;
         white-space: nowrap;
+        &::-webkit-scrollbar {
+            display: none;
+        }
         .item {
             display: inline-block;
             overflow: hidden;

+ 1 - 1
http/index.js

@@ -21,7 +21,7 @@ instance.interceptors.response.use(
 		if (res.data.code === -107) {
 			// token失效
 			removeStorage(storageKey.userInfo);
-			location.reload();
+			// location.reload();
 		} else {
 			return res.data;
 		}

+ 25 - 15
pages/payment/index.vue

@@ -9,16 +9,16 @@
                         <template v-if="salePlans && salePlans.currencyCode && salePlans.currencyCode !== 'USD'">
                             <template v-if="salePlans.price.length + salePlans.currencyInfo.tokenSymbol.length >= 30">
                                 <div style="text-align:center">
-                                    <div><img class="icon" :src="salePlans.currencyInfo.iconPath" /> {{ salePlans.price }}</div>
-                                    <div>{{ salePlans.currencyInfo.tokenSymbol }} (${{salePlans.usdPrice}})</div>
+                                    <div><img class="icon" :src="salePlans.currencyInfo.iconPath" /> {{ salePlans.price | floatPrice(4) }}</div>
+                                    <div>{{ salePlans.currencyInfo.tokenSymbol }} (${{salePlans.usdPrice | floatPrice(2)}})</div>
                                 </div>
                             </template>
                             <template v-else>
-                                <img class="icon" :src="salePlans.currencyInfo.iconPath" /> {{ salePlans.price }} {{ salePlans.currencyInfo.tokenSymbol }} (${{salePlans.usdPrice}})
+                                <img class="icon" :src="salePlans.currencyInfo.iconPath" /> {{ salePlans.price | floatPrice(4) }} {{ salePlans.currencyInfo.tokenSymbol }} (${{salePlans.usdPrice | floatPrice(2)}})
                             </template>
                         </template>
                         <template v-else>
-                            <span class="info usd">${{salePlans.usdPrice}}</span>
+                            <span class="info usd">${{salePlans.usdPrice | floatPrice(2)}}</span>
                         </template>
                     </FontZoom>
                 </div>
@@ -33,7 +33,7 @@
                         </div>
                         <div class="wallet">
                             <FontZoom width="300" :unColor="true">
-                                Balance:{{currencyInfoData.balance}} {{currencyInfoData.tokenSymbol}}
+                                Balance:{{currencyInfoData.balance | floatPrice(4)}} {{currencyInfoData.tokenSymbol}}
                             </FontZoom>
                         </div>
                     </div>
@@ -51,7 +51,7 @@
                             <span>DeNet Pay</span>
                         </div>
                         <div class="wallet">
-                            Balance:{{currencyInfoData.balance}} {{currencyInfoData.tokenSymbol}}
+                            Balance:{{currencyInfoData.balance | floatPrice(2)}} {{currencyInfoData.tokenSymbol}}
                         </div>
                     </div>
                     <div class="item" @click="achPay(true, Report.objectType.mastercardPayButton)">
@@ -80,7 +80,7 @@
                 <div class="text">Balance</div>
                 <div class="money">
                     <FontZoom width="300" :unColor="true">
-                        <img class="icon" :src="currencyInfoData.iconPath" /> {{currencyInfoData.balance}} {{currencyInfoData.tokenSymbol}}
+                        <img class="icon" :src="currencyInfoData.iconPath" /> {{ salePlans.currencyCode === 'USD' ? (currencyInfoData.balance | floatPrice(2)) : (currencyInfoData.balance | floatPrice(4)) }} {{currencyInfoData.tokenSymbol}}
                     </FontZoom>
                 </div>
                 <template v-if="waitRefresh">
@@ -97,7 +97,7 @@
                     <div class="neet">You Neet to Pay</div>
                     <div class="money">
                         <FontZoom width="190" :unColor="true">
-                            <span class="text">{{salePlans.price}} {{ salePlans.currencyInfo.tokenSymbol }}</span>
+                            <span class="text">{{ salePlans.currencyCode === 'USD' ? (salePlans.price | floatPrice(2)) : (salePlans.price | floatPrice(4)) }} {{ salePlans.currencyInfo.tokenSymbol }}</span>
                         </FontZoom>
                     </div>
                 </div>
@@ -126,7 +126,7 @@
                             <div class="r">
                                 <FontZoom width="260" :unColor="true">
                                     <img :src="currencyInfoData.iconPath" />
-                                    <span>{{ usdAmountData.rechargeAmountValue || 0 }} {{currencyInfoData.tokenSymbol}}</span>
+                                    <span>{{ usdAmountData.rechargeAmountValue | floatPrice(4) }} {{currencyInfoData.tokenSymbol}}</span>
                                 </FontZoom>
                             </div>
                         </div>
@@ -155,7 +155,7 @@
                         </div>
                         <div class="text">
                             <FontZoom width="260" :unColor="true">
-                                <span>Balance: {{ currencyInfoData.balance }} {{ currencyInfoData.tokenSymbol }}</span>
+                                <span>Balance: {{ currencyInfoData.balance | floatPrice(4) }} {{ currencyInfoData.tokenSymbol }}</span>
                             </FontZoom>
                         </div>
                         <div
@@ -170,7 +170,7 @@
                         <div class="neet">You Neet to Pay</div>
                         <div class="money">
                             <FontZoomMobile width="260" :unColor="true">
-                                {{salePlans.price}} {{ salePlans.currencyInfo.tokenSymbol }}
+                                {{salePlans.price | floatPrice(4)}} {{ salePlans.currencyInfo.tokenSymbol }}
                             </FontZoomMobile>
                         </div>
                     </div>
@@ -189,15 +189,15 @@
                     <div class="top">
                         <div class="item usd">
                             <div class="l">Payment amount</div>
-                            <div class="r fontPayment">${{ usdAmountData.orderAmountValue }}</div>
+                            <div class="r fontPayment">${{ usdAmountData.orderAmountValue | floatPrice(2) }}</div>
                         </div>
                         <div class="item usd">
                             <div class="l">Balance</div>
-                            <div class="r font">${{ usdAmountData.balance }}</div>
+                            <div class="r font">${{ usdAmountData.balance | floatPrice(2) }}</div>
                         </div>
                         <div class="item usd" v-if="Number(usdAmountData.rechargeAmountValue) > 0">
                             <div class="l">{{ usdAmountData.feeDesc }}</div>
-                            <div class="r font">${{ usdAmountData.feeAmountValue }}</div>
+                            <div class="r font">${{ usdAmountData.feeAmountValue | floatPrice(2) }}</div>
                         </div>
                         <div class="item usd" v-if="Number(usdAmountData.rechargeAmountValue) > 0">
                             <div class="l">Deposit Amount</div>
@@ -210,7 +210,7 @@
                         <div class="icon">
                             <img src="../../static/img/icon_balance_blue.svg" />
                         </div>
-                        <div class="text">Balance: ${{currencyInfoData.balance}}</div>
+                        <div class="text">Balance: ${{currencyInfoData.balance | floatPrice(2)}}</div>
                         <div
                             class="refresh"
                             @click="checkUsdCurrencyInfo">
@@ -339,6 +339,16 @@ export default {
     beforeDestroy() {
         clearTimeout(this.currencyTimer);
     },
+    filters: {
+        floatPrice(price, num) {
+            if (!price) return;
+            if (price.indexOf('.') >= 0) {
+                let reg = new RegExp(`^\\D*(\\d*(?:\\.\\d{0,${num}})?).*$`, "g");
+                price = price.replace(reg, '$1');
+            }
+            return price;
+        }
+    },
     methods : {
         saleInfo () {
             postRequest(Api.getNftMysteryBoxSaleInfo, {