Przeglądaj źródła

Merge branch 'dev_1.1.7_by_nft' into dev_1.1.7_test

nieyuge 2 lat temu
rodzic
commit
529440d545
4 zmienionych plików z 63 dodań i 26 usunięć
  1. 19 7
      components/MobileBuyNft.vue
  2. 1 1
      http/index.js
  3. 3 0
      pages/payment/ach.vue
  4. 40 18
      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;
 		}

+ 3 - 0
pages/payment/ach.vue

@@ -46,6 +46,9 @@ export default {
                         this.formData = res.data;
                         this.$nextTick(() => {
                             this.$refs.formDom.submit();
+                            setTimeout(() => {
+                                location.go(-1);
+                            }, 500)
                         })
                     }
                 })

+ 40 - 18
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,12 @@
                 <div class="text">Balance</div>
                 <div class="money">
                     <FontZoom width="300" :unColor="true">
-                        <img class="icon" :src="currencyInfoData.iconPath" /> {{currencyInfoData.balance}} {{currencyInfoData.tokenSymbol}}
+                        <template v-if="salePlans.currencyCode === 'USD'">
+                            <img class="icon" :src="currencyInfoData.iconPath" /> {{ currencyInfoData.balance | floatPrice(2) }} {{currencyInfoData.tokenSymbol}}
+                        </template>
+                        <template v-else>
+                            <img class="icon" :src="currencyInfoData.iconPath" /> {{ currencyInfoData.balance | floatPrice(4) }} {{currencyInfoData.tokenSymbol}}
+                        </template>
                     </FontZoom>
                 </div>
                 <template v-if="waitRefresh">
@@ -97,7 +102,14 @@
                     <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">
+                                <template v-if="salePlans.currencyCode === 'USD'">
+                                    {{ salePlans.price | floatPrice(2) }} {{ salePlans.currencyInfo.tokenSymbol }}
+                                </template>
+                                <template v-else>
+                                    {{ salePlans.price | floatPrice(4) }} {{ salePlans.currencyInfo.tokenSymbol }}
+                                </template>
+                            </span>
                         </FontZoom>
                     </div>
                 </div>
@@ -121,12 +133,12 @@
                             <img src="../../static/img/icon_deposit.png" />
                             <span>Deposit to Buy</span>
                         </div>
-                        <div class="item column">
+                        <div class="item column" v-if="Number(usdAmountData.rechargeAmountValue) > 0">
                             <div class="l">Deposit</div>
                             <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 +167,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
@@ -169,8 +181,8 @@
                     <div class="l">
                         <div class="neet">You Neet to Pay</div>
                         <div class="money">
-                            <FontZoomMobile width="260" :unColor="true">
-                                {{salePlans.price}} {{ salePlans.currencyInfo.tokenSymbol }}
+                            <FontZoomMobile width="220" :unColor="true">
+                                {{salePlans.price | floatPrice(4)}} {{ salePlans.currencyInfo.tokenSymbol }}
                             </FontZoomMobile>
                         </div>
                     </div>
@@ -189,15 +201,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 +222,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">
@@ -222,7 +234,7 @@
                     <div class="l">
                         <div class="neet">You Neet to Pay</div>
                         <div class="money">
-                            <FontZoomMobile width="260" :unColor="true">
+                            <FontZoomMobile width="220" :unColor="true">
                                 {{ Number(usdAmountData.rechargeAmountValue) > 0 ? usdAmountData.rechargeAmountValue : usdAmountData.orderAmountValue }} {{ salePlans.currencyInfo.tokenSymbol }}
                             </FontZoomMobile>
                         </div>
@@ -339,6 +351,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, {