Răsfoiți Sursa

使用兑换券

xuqiang 4 ani în urmă
părinte
comite
5880f4488a

+ 1 - 0
src/main/pc-space/src/components/CouponInfo.vue

@@ -51,6 +51,7 @@ export default {
                     {
                         query: {
                             userId: this.userInfo.id
+                            // used: true
                         }
                     },
                     {

+ 17 - 0
src/main/pc-space/src/mixins/coupon.js

@@ -0,0 +1,17 @@
+import dayjs from 'dayjs';
+var isSameOrBefore = require('dayjs/plugin/isSameOrBefore');
+dayjs.extend(isSameOrBefore);
+export default {
+    methods: {
+        checkTime(info) {
+            return dayjs().isSameOrBefore(info.expiration);
+        },
+        checkUse(info, collectionId = 0) {
+            if (collectionId && info.limited) {
+                return [...info.collectionIds].includes(collectionId);
+            } else {
+                return true;
+            }
+        }
+    }
+};

+ 38 - 10
src/main/pc-space/src/views/AssetDetail.vue

@@ -151,9 +151,22 @@
                                 @mouseenter="isShowPopover(item.name, true)"
                                 @mouseleave="isShowPopover(item.name, false)"
                             >
-                                <div @click.stop="privilegeFn(item)">
-                                    <img v-if="item.opened" class="img2" :src="item.icon[2]" alt="" />
-                                    <img v-if="!item.opened" class="img2" :src="item.icon[3]" alt="" />
+                                <div v-if="item.icon[2]">
+                                    <!-- 只能点一次 -->
+                                    <div v-if="item.once" @click="privilegeFn2(item)">
+                                        <img v-if="item.opened" class="img2" :src="item.icon[2]" alt="" />
+                                    </div>
+                                    <!-- 多次点 -->
+                                    <div v-else @click="privilegeFn(item)">
+                                        <img v-if="item.opened" class="img2" :src="item.icon[2]" alt="" />
+                                    </div>
+                                    <div @click="privilegeFn(item)">
+                                        <img v-if="!item.opened" class="img2" :src="item.icon[3]" alt="" />
+                                    </div>
+                                </div>
+                                <!-- 新加特权 -->
+                                <div @click="privilegeFn2(item)" v-else>
+                                    <img class="img2" :src="item.icon[0]" alt="" />
                                 </div>
                                 <div class="hoverTips" v-if="popoverStatus[item.name]">
                                     <div class="span">{{ item.name }}</div>
@@ -201,7 +214,7 @@
                             <img class="imgs" src="../assets/info_icon_jiaoyijilu.png" alt="" />
                             <span>交易历史</span>
                         </template>
-                        <el-table class="elTable" :data="tableData" stripe style="width: 100%">
+                        <el-table class="elTable" :data="tableData" stripe style="width: 100%; background: #1c1e26">
                             <el-table-column prop="fromUser" label="用户" width="555"> </el-table-column>
                             <el-table-column prop="operation" label="操作" width="455"> </el-table-column>
                             <el-table-column prop="createdAt" label="时间"> </el-table-column>
@@ -402,9 +415,24 @@ export default {
             }
         },
         privilegeFn(init) {
-            console.log(111);
+            // console.log(111);
             this.list2 = init;
-            if (!init.once) {
+            this.show4 = true;
+            this.$http
+                .post('/asset/usePrivilege', {
+                    assetId: this.info.id,
+                    privilegeId: init.id
+                })
+                .then(res => {
+                    console.log(res);
+                });
+        },
+        privilegeFn2(init) {
+            // console.log(222);
+            // this.list2 = init;
+            // this.show4 = true;
+            if (init.once && init.opened == false) {
+                this.list2 = init;
                 this.show4 = true;
                 this.$http
                     .post('/asset/usePrivilege', {
@@ -451,7 +479,7 @@ export default {
                 }
                 if (res.privileges) {
                     this.init = res.privileges.filter(item => {
-                        return item.name !== '悄悄话' && item.name !== '加密空间';
+                        return item.name !== '悄悄话';
                     });
                 }
                 this.loading = false;
@@ -1241,9 +1269,9 @@ export default {
                 height: 24px;
             }
         }
-        .elTable {
-            border: 1px solid red;
-        }
+        // .elTable {
+        //     border: 1px solid red;
+        // }
         .border {
             height: 1px;
             background: #494a4d;

+ 1 - 0
src/main/pc-space/src/views/CollectionDetail.vue

@@ -386,6 +386,7 @@ export default {
         },
         submit() {
             this.$refs.sub.init(this.info);
+            // this.$refs.sub.CoupFn();
         }
     }
 };

+ 6 - 2
src/main/pc-space/src/views/Submit.vue

@@ -251,7 +251,8 @@ export default {
                     '/userCoupon/all',
                     {
                         query: {
-                            userId: this.userInfo.id
+                            userId: this.userInfo.id,
+                            used: false
                         }
                     },
                     {
@@ -270,8 +271,11 @@ export default {
         all() {
             this.show2 = true;
         },
+        // CoupFn(){
+
+        // },
         choose(info) {
-            // console.log(info);
+            console.log(info);
 
             this.chooseId = info.id;
             this.$store.commit('setCouponInfo', info);