xuqiang 4 سال پیش
والد
کامیت
79bbedd8dd

+ 1 - 1
src/main/pc-space/src/components/PageHeader.vue

@@ -92,7 +92,7 @@ export default {
                     value: '/collection?type=BLIND_BOX'
                 },
                 {
-                    label: '我的NFT',
+                    label: '我的藏品',
                     value: '/my'
                 },
                 {

+ 15 - 0
src/main/pc-space/src/mixins/common.js

@@ -58,6 +58,21 @@ export default {
         //         return Promise.resolve(res.data);
         //     });
         // },
+        accAdd(arg1, arg2) {
+            var r1, r2, m;
+            try {
+                r1 = arg1.toString().split('.')[1].length;
+            } catch (e) {
+                r1 = 0;
+            }
+            try {
+                r2 = arg2.toString().split('.')[1].length;
+            } catch (e) {
+                r2 = 0;
+            }
+            m = Math.pow(10, Math.max(r1, r2));
+            return (arg1 * m + arg2 * m) / m;
+        },
         updateFile(e, size = 2000) {
             console.log(e);
             const formData = new FormData();

+ 5 - 1
src/main/pc-space/src/store/index.js

@@ -11,7 +11,8 @@ export default new Vuex.Store({
         historys: [],
         institutionInfo: null,
         personalInfo: null,
-        showAdd: false
+        showAdd: false,
+        couponInfo: null
     },
     mutations: {
         setKeeps(state, keeps) {
@@ -25,6 +26,9 @@ export default new Vuex.Store({
         },
         updateShowAdd(state, showAdd) {
             state.showAdd = showAdd;
+        },
+        setCouponInfo(state, couponInfo) {
+            state.couponInfo = couponInfo;
         }
     },
     actions: {

+ 4 - 1
src/main/pc-space/src/views/CastingDetail.vue

@@ -185,7 +185,10 @@ export default {
     position: relative;
     padding: 66px 50px;
 }
-
+// .select {
+//     border: 1px solid #898989;
+//     border-radius: 8px;
+// }
 .info {
     .name {
         font-size: 24px;

+ 1 - 1
src/main/pc-space/src/views/My.vue

@@ -1,6 +1,6 @@
 <template>
     <div class="container center-content">
-        <div class="title">我的 NFT</div>
+        <div class="title">我的藏品</div>
         <el-radio-group class="menu" v-model="select" size="normal">
             <el-radio-button v-for="(item, index) in typeList" :key="index" :label="item.value">
                 <div class="radio-item">

+ 11 - 25
src/main/pc-space/src/views/Submit.vue

@@ -57,6 +57,7 @@
 <script>
 import vueQrcode from '@chenfengyuan/vue-qrcode';
 import resolveUrl from 'resolve-url';
+import { mapState } from 'vuex';
 import { add } from 'mathjs';
 export default {
     data() {
@@ -102,32 +103,17 @@ export default {
             );
         },
         money() {
-            if (this.info.price) {
-                return add(this.info.price, this.gas);
-            } else {
-                return 0;
+            let money = 0;
+            if (this.info.price && !this.couponInfo) {
+                money = this.accAdd(this.info.price, money);
             }
-            // add(this.info.price, this.gas)
-            // if (this.info.price) {
-            //     return this.info.price.reduce((prev, cur) => {
-            //         var r1, r2, m;
-            //         try {
-            //             r1 = prev.toString().split('.')[1].length;
-            //         } catch (e) {
-            //             r1 = 0;
-            //         }
-            //         try {
-            //             r2 = cur.money.toString().split('.')[1].length;
-            //         } catch (e) {
-            //             r2 = 0;
-            //         }
-            //         m = Math.pow(10, Math.max(r1, r2));
-            //         return (prev * m + cur.money * m) / m;
-            //     }, 0);
-            // } else {
-            //     return 0;
-            // }
-        }
+            if (this.gas && (!this.couponInfo || this.couponInfo.needGas)) {
+                money = this.accAdd(money, this.gas);
+            }
+
+            return money;
+        },
+        ...mapState(['couponInfo'])
     },
     methods: {
         submit() {