Browse Source

铸造库存显示

panhui 3 years ago
parent
commit
d717c36925
2 changed files with 39 additions and 8 deletions
  1. 17 6
      src/views/activity/Detail1.vue
  2. 22 2
      src/views/activity/List1.vue

+ 17 - 6
src/views/activity/Detail1.vue

@@ -12,10 +12,10 @@
                 <!-- <div class="info">
                     <div class="text1">限量</div>
                     <div>{{ info.total }}份</div>
-                </div>
-                <div class="info">
-                    <div>剩余 {{ info.stock }}</div>
                 </div> -->
+                <div class="info" v-if="showStok">
+                    <div>剩余 {{ info.stock }}</div>
+                </div>
 
                 <div class="flex1"></div>
                 <van-button :disabled="startTime" type="primary" round v-if="startTime">{{ startTime }}</van-button>
@@ -43,16 +43,27 @@ export default {
             info: {},
             timer: null,
             startTime: '',
-            holdingFlag: false
+            holdingFlag: false,
+            showCollections: [],
+            activityId: 0
         };
     },
     computed: {
         isSolded() {
             return !this.info.stock || this.info.stock < 0;
+        },
+        showStok() {
+            return [...this.showCollections].includes(this.activityId);
         }
     },
     mounted() {
+        this.activityId = this.$route.query.id;
         this.getProduct(true);
+        this.$http.get('/sysConfig/get/mint_countCollection').then(res => {
+            if (res.value) {
+                this.showCollections = res.value.split(',');
+            }
+        });
     },
     methods: {
         goBuild() {
@@ -65,13 +76,13 @@ export default {
             );
         },
         getProduct(init = false) {
-            this.$http.get('/mintActivity/get/' + this.$route.query.id).then(res => {
+            this.$http.get('/mintActivity/get/' + this.activityId).then(res => {
                 this.info = res;
                 if (res.scheduleSale && init && res.startTime) {
                     this.getTime();
                 }
                 if (res.holdingTags && res.holdingTags.length) {
-                    this.$http.get('/mintOrder/checkHolding', { id: this.$route.query.id }).then(res => {
+                    this.$http.get('/mintOrder/checkHolding', { id: this.activityId }).then(res => {
                         this.holdingFlag = res;
                     });
                 } else {

+ 22 - 2
src/views/activity/List1.vue

@@ -80,14 +80,16 @@ import SwiperCore, { Pagination, Autoplay } from 'swiper';
 SwiperCore.use([Pagination, Autoplay]);
 import banner from '../../mixins/banner';
 export default {
-    name: 'Search',
+    name: 'activityList',
     mixins: [list, banner],
+    inject: ['setKeeps', 'scrollWrapper', 'changeScroll'],
     data() {
         return {
             list: [],
             empty: false,
             url: '/mintActivity/all',
-            banners: []
+            banners: [],
+            scrollTop: 0
         };
     },
     components: {
@@ -138,6 +140,24 @@ export default {
                 this.isLoading = false;
             });
         }
+    },
+    activated() {
+        this.$nextTick(() => {
+            this.changeScroll(this.scrollTop);
+        });
+        if (window.cordova && StatusBar && StatusBar.isVisible) {
+            StatusBar.styleLightContent();
+        }
+    },
+    beforeRouteLeave(to, from, next) {
+        if (to.path === '/activityDetail') {
+            this.scrollTop = this.scrollWrapper.scrollTop;
+            this.setKeeps(['activityList']);
+        } else {
+            this.scrollTop = 0;
+            this.setKeeps(['activityList'], false);
+        }
+        next();
     }
 };
 </script>