panhui hace 3 años
padre
commit
bb9b8c047d

+ 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
 VUE_APP_PUBLIC_PATH=/
 ASSETS_PATH=raex

BIN
src/assets/icon-back-next.png


+ 56 - 22
src/components/product/SaleInfo.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="sale-box" v-if="totalElements > 0">
+    <div class="sale-box" v-if="total > 0 && showInfo.price">
         <div class="sale-info">
             <div class="text1">当前寄售最低价格</div>
             <div class="text2">
@@ -7,12 +7,15 @@
                 <span>{{ showInfo.price }}</span>
             </div>
         </div>
-        <div class="sale-info">
-            <div class="text1">当前寄售</div>
-            <div class="text2">{{ totalElements }}份</div>
+        <div class="sale-info" @click="show = true">
+            <div class="text1">
+                当前寄售
+                <img src="@/assets/icon-back-next.png" alt="" />
+            </div>
+            <div class="text2">{{ total }}份</div>
         </div>
     </div>
-    <van-action-sheet teleport="#app" ref="action" v-model:show="show" :title="`当前寄售(${totalElements}份)`">
+    <van-action-sheet teleport="#app" ref="action" v-model:show="show" :title="`当前寄售(${total}份)`">
         <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="getData">
             <div @click="goDetail(item)" class="product-info" v-for="(item, index) in list" :key="index">
                 <div class="top">
@@ -39,6 +42,7 @@
 </template>
 
 <script>
+import { throwStatement } from '@babel/types';
 import list from '../../mixins/list';
 export default {
     props: {
@@ -60,38 +64,62 @@ export default {
             url: '/collection/all',
             list: [],
             totalElements: 0,
-            show: false
+            show: false,
+            showInfo: {
+                price: 0
+            },
+            total: 0
         };
     },
     mixins: [list],
     computed: {
-        showInfo() {
-            if (!this.empty && !this.loading) {
-                return {
-                    ...this.list[0]
-                };
-            } else {
-                return {
-                    price: 0
-                };
-            }
-        },
         search() {
             if (this.info.prefixName) {
                 return this.info.prefixName;
             }
+            let name = this.info.name;
             if (this.info.type === 'BLIND_BOX') {
-                let name = this.blindBoxItems.length > 0 ? this.blindBoxItems[0].name.split('#')[0] : '';
-                name = name.replace(/:/, '·');
-                name = name.replace(/:/, '·');
-                return name.split('·')[0];
+                name = this.blindBoxItems.length > 0 ? this.blindBoxItems[0].name.split('#')[0] : '';
             }
-            return this.info.name;
+
+            name = name.replace(/:/, '·');
+            name = name.replace(/:/, '·');
+            return name.split('·')[0];
         }
     },
     methods: {
+        getMarketData() {
+            return this.$http
+                .post(
+                    '/collection/all',
+                    {
+                        query: {
+                            source: 'TRANSFER',
+                            salable: true
+                        },
+                        search: this.search,
+                        sort: 'price,asc',
+                        size: 1,
+                        page: 0
+                    },
+                    { body: 'json' }
+                )
+                .then(res => {
+                    if (!res.empty) {
+                        this.showInfo = res.content[0];
+                    } else {
+                        this.showInfo = {
+                            price: 0
+                        };
+                    }
+                    this.total = res.totalElements;
+                    this.getData(true);
+                    return Promise.resolve(res.totalElements);
+                });
+        },
         goDetail(info) {
             if (!info.soldOut) {
+                this.show = false;
                 this.$router.push({
                     path: '/productDetail/' + info.id
                 });
@@ -109,6 +137,7 @@ export default {
         },
         init() {
             this.show = true;
+            this.getData(true);
         },
         getNum(info) {
             if (info.number) {
@@ -192,6 +221,11 @@ export default {
             font-size: 12px;
             color: @text0;
             line-height: 24px;
+            .flex();
+            img {
+                width: 16px;
+                height: 16px;
+            }
         }
 
         .text2 {

+ 16 - 15
src/views/product/Detail.vue

@@ -94,9 +94,13 @@
                                 <span>剩余 {{ Math.min(Math.max(info.stock, 0), info.total) }}</span>
                             </div>
                             <div class="text" v-if="info.couponPayment">优惠券藏品</div>
+                            <div class="text total" v-if="totalSales > 0">
+                                <span>流通</span>
+                                <span>{{ totalSales }}份</span>
+                            </div>
                         </div>
 
-                        <sale-info ref="sale" v-if="canSale" :info="info" :blindBoxItems="blindBoxItems"></sale-info>
+                        <sale-info ref="sale" :info="info" :blindBoxItems="blindBoxItems"></sale-info>
 
                         <tasks
                             v-if="assignment && info.totalQuota"
@@ -415,7 +419,7 @@
                         </div>
                     </div>
 
-                    <div
+                    <!-- <div
                         class="btn van-safe-area-bottom"
                         ref="btn"
                         v-if="canSale && totalSales > 0 && !$store.state.reviewPay"
@@ -423,7 +427,7 @@
                         <div class="btn-list btn-only">
                             <van-button type="primary" @click="showSale" block round>我想要</van-button>
                         </div>
-                    </div>
+                    </div> -->
                     <div class="btn van-safe-area-bottom" v-else-if="info.inPaying">
                         <div class="status-text">支付中</div>
                     </div>
@@ -585,10 +589,10 @@
                 </template>
 
                 <template v-else>
-                    <div class="stiky-status stiky-btn" v-if="canSale && totalSales > 0 && !$store.state.reviewPay">
+                    <!-- <div class="stiky-status stiky-btn" v-if="canSale && totalSales > 0 && !$store.state.reviewPay">
                         <van-button type="primary" @click="showSale" block round>我想要</van-button>
-                    </div>
-                    <div class="stiky-status" v-else-if="info.inPaying">
+                    </div> -->
+                    <div class="stiky-status" v-if="info.inPaying">
                         <div class="status-text">支付中</div>
                     </div>
                     <div
@@ -929,7 +933,6 @@ export default {
             return this.$http
                 .get('/collection/get/' + this.collectionId)
                 .then(res => {
-                    console.log('1828');
                     if (this.$store.state.from === 'scanCode') {
                         res.onShelf = true;
                         this.checkLogin();
@@ -1013,13 +1016,11 @@ export default {
                     if (res) {
                         this.blindBoxItems = res.content;
                     }
-                    this.$nextTick(() => {
-                        if (this.canSale) {
-                            this.$refs.sale.getData(true).then(num => {
-                                this.totalSales = num;
-                            });
-                        }
-                    });
+                    setTimeout(() => {
+                        this.$refs.sale.getMarketData().then(num => {
+                            this.totalSales = num;
+                        });
+                    }, 100);
                 })
                 .catch(e => {
                     this.$toast.clear();
@@ -1530,7 +1531,7 @@ export default {
 
 .info {
     // height: 164px;
-    background-color: #1c1c1c;
+    background-color: #0f0f0f;
     // border-radius: 20px 20px 0 0;
     // transform: translateY(-16px);
     position: relative;