panhui 4 سال پیش
والد
کامیت
9d1e4af184

+ 1 - 1
.env.development

@@ -1,4 +1,4 @@
-VUE_APP_BASE_URL=https://test.raex.vip/
+VUE_APP_BASE_URL=https://www.raex.vip
 NODE_ENV=development
 PUBLIC_PATH=/
 ASSETS_PATH=raex

+ 20 - 11
src/components/product/productInfo.vue

@@ -1,13 +1,5 @@
 <template>
-    <router-link
-        :to="{
-            path: '/productDetail',
-            query: {
-                id: info.id
-            }
-        }"
-        class="product"
-    >
+    <div class="product" @click="goDetail">
         <van-image width="100%" height="calc(50vw - 24px)" :src="getImg(changeImgs(info.pic, 600))" fit="cover" />
 
         <div class="content">
@@ -36,9 +28,14 @@
                     {{ info.likes }}
                 </like-button>
             </div>
-            <div class="sold" v-if="isSold">已售馨</div>
+            <div class="sold xianliang" v-if="time && info.salable">
+                <img src="@assets/shizhong.png" alt="" />
+                <span>{{ startTime || time }}</span>
+            </div>
+            <div class="sold" v-if="isSolded">已售罄</div>
+            <div class="sold" v-else-if="isSold" style="color: #ff4f50;">即将售罄</div>
         </div>
-    </router-link>
+    </div>
 </template>
 
 <script>
@@ -74,6 +71,18 @@ export default {
                     this.$toast.success('取消收藏');
                 });
             }
+        },
+        goDetail() {
+            if (!this.usedBuy && this.info.source === 'TRANSFER') {
+                this.$toast('该通道暂且关闭');
+            } else {
+                this.$router.push({
+                    path: '/productDetail',
+                    query: {
+                        id: this.info.id
+                    }
+                });
+            }
         }
     }
 };

+ 2 - 8
src/mixins/product.js

@@ -1,13 +1,6 @@
 import dayjs from 'dayjs';
 import { abs } from 'mathjs';
-require('dayjs/locale/zh-cn');
-dayjs.locale('zh-cn');
-var relativeTime = require('dayjs/plugin/relativeTime');
-dayjs.extend(relativeTime);
-var calendar = require('dayjs/plugin/calendar');
-dayjs.extend(calendar);
-var duration = require('dayjs/plugin/duration');
-dayjs.extend(duration);
+import { mapState } from 'vuex';
 export default {
     data() {
         return {
@@ -44,6 +37,7 @@ export default {
         };
     },
     computed: {
+        ...mapState(['usedBuy']),
         bannerList() {
             return [...this.changeImgs(this.banners)].map(item => {
                 return this.getImg(item, '', 800);

+ 43 - 1
src/store/index.js

@@ -7,7 +7,14 @@ export default createStore({
         userInfo: null,
         firstUrl: '',
         couponInfo: null,
-        invitor: null
+        invitor: null,
+        review: false,
+        from: '',
+        inviteCode: '',
+        loginBackUrl: '',
+        productId: '',
+        netTime: 0,
+        usedBuy: true
     },
     mutations: {
         setFinished(state, finished) {
@@ -24,6 +31,27 @@ export default createStore({
         },
         setInvitor(state, invitor) {
             state.invitor = invitor;
+        },
+        setProductId(state, productId) {
+            state.productId = productId;
+        },
+        setReview(state, review) {
+            state.review = review;
+        },
+        setFrom(state, from) {
+            state.from = from;
+        },
+        setInviteCode(state, inviteCode) {
+            state.inviteCode = inviteCode;
+        },
+        setLoginBackUrl(state, loginBackUrl) {
+            state.loginBackUrl = loginBackUrl;
+        },
+        setNetTime(state, netTime) {
+            state.netTime = netTime;
+        },
+        setUsedBuy(state, usedBuy) {
+            state.usedBuy = usedBuy;
         }
     },
     actions: {
@@ -38,6 +66,20 @@ export default createStore({
                     context.commit('setUserInfo', null);
                     return Promise.reject();
                 });
+        },
+        getTime(context) {
+            http.http.get('/auth/getTime').then(res => {
+                context.commit('setNetTime', Number(res) - new Date().getTime());
+            });
+        },
+        getUsedBuy(context) {
+            http.http.get('/sysConfig/get/used_buy').then(res => {
+                if (res.value === '0') {
+                    context.commit('setUsedBuy', false);
+                } else {
+                    context.commit('setUsedBuy', true);
+                }
+            });
         }
     },
     modules: {}

+ 2 - 1
src/views/Discover.vue

@@ -101,7 +101,7 @@
         <div class="box">
             <page-title title="更多藏品" :isLink="false"></page-title>
             <van-list
-                style="padding-bottom: 100px"
+                style="padding-bottom: 100px;"
                 class="box-list"
                 v-model:loading="loading"
                 :finished="finished"
@@ -159,6 +159,7 @@ export default {
         };
     },
     mounted() {
+        this.$store.dispatch('getUsedBuy');
         this.getInit();
     },
     methods: {

+ 20 - 7
src/views/product/Detail.vue

@@ -305,6 +305,8 @@ export default {
         }
     },
     mounted() {
+        this.$store.dispatch('getUsedBuy');
+        this.$store.dispatch('getTime');
         this.getProduct();
     },
     methods: {
@@ -414,13 +416,24 @@ export default {
         },
         buy() {
             this.checkLogin().then(() => {
-                this.$router.push({
-                    path: '/submit',
-                    query: {
-                        id: this.$route.query.id,
-                        invitor: this.$route.query.invitor
-                    }
-                });
+                if (this.info.couponPayment && this.couponList.length === 0) {
+                    this.$dialog
+                        .alert({
+                            title: '提示',
+                            message: '该藏品为特殊藏品,需要使用优惠券才能兑换'
+                        })
+                        .then(() => {});
+                } else if (!this.usedBuy && this.info.source === 'TRANSFER') {
+                    this.$toast('该通道暂且关闭');
+                } else {
+                    this.$router.push({
+                        path: '/submit',
+                        query: {
+                            id: this.$route.query.id,
+                            invitor: this.$route.query.invitor
+                        }
+                    });
+                }
             });
         }
     }

+ 1 - 0
src/views/product/List.vue

@@ -84,6 +84,7 @@ export default {
         }
     },
     mounted() {
+        this.$store.dispatch('getUsedBuy');
         if (this.$route.query.type) {
             this.type = this.$route.query.type;
         }

+ 1 - 0
src/views/product/Search.vue

@@ -71,6 +71,7 @@ export default {
         };
     },
     mounted() {
+        this.$store.dispatch('getUsedBuy');
         if (this.$route.query.type) {
             this.type = this.$route.query.type;
         }